home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: sci.math.symbolic
- Path: sparky!uunet!stanford.edu!snorkelwacker.mit.edu!bloom-picayune.mit.edu!athena.mit.edu!fmmoore
- From: fmmoore@athena.mit.edu (Fes-Mike Moore)
- Subject: function arguments type checking in MapleV
- Message-ID: <FMMOORE.92Aug25193637@momoney.mit.edu>
- Sender: news@athena.mit.edu (News system)
- Nntp-Posting-Host: momoney.mit.edu
- Organization: Massachusetts Institute of Technology
- Date: Tue, 25 Aug 1992 23:36:43 GMT
- Lines: 41
-
- I'm trying to define type/procargs as described in ?type[argcheck] (page
- 223 of the Maple V Library Reference manual). This is what I'm
- entering:
-
- > `type/expectationargs` := [indexed * function(indexed)];
- type/expectationargs := [indexed function(indexed)]
- > expectation := proc(expr)
- > local i,j,k,l;
- > if not type([expr], expectationargs) then
- > ERROR(
- > `invalid arguments; must be in form of indexed * function(indexed)`)
- > fi;
- > i := op(1,op(1,expr));
- > j := op(2,op(1,expr));
- > k := op(1,op(1,op(2,expr)));
- > l := op(2,op(1,op(2,expr)));
- > print(i,j,k,l)
- > end;
-
- When I run the program, though, I get:
-
- > testarg := z[a,b]*conjugate(z[fes,mike]);
- testarg := z[a, b] conjugate(z[fes, mike])
-
- _____________________________________________________________________
- > expectation(testarg);
- Error, (in expectation) testing against an invalid type
-
- Aren't function and indexed valid types? If so, why can't they be used
- in this manner? Or am I overlooking something else? In general I can
- do:
-
- > type(conjugate(x), function(name));
- true
-
- so I presumably shouldn't have any problems with this...
-
- Thanks for your help...
- --
- Fes-Mike Moore
- CSSC Student Consultant
-