On Wed, Nov 18, 2009 at 3:16 AM, Leo Butler <l.butler at ed.ac.uk> wrote:
> To amplify RJF's comment...
> It would be nice if Maxima had a function devoted to argument checking
> (q: does it, and I am ignorant?), or even better, if it understood the
> syntax
>
> foo(x::list) := ....
I'm in favor of such a feature, which could be put in place with
modest effort and without messing up any existing function definitions.
However, since "::" already means something (it's an assignment
operator) I'd rather see a different notation.
How about
foo (P(x)) := ...
where P is some predicate e.g. listp, integerp, symbolp, etc.
possibly including lambda expressions for good measure.
I think that's very much preferable to burdening the function
definition with boilerplate code like: if not listp(x) then error("Rats!");
best
Robert Dodier