argument checking, was: About submatrix and its meaning



I hadn't thought of ? for Lisp symbols.  Then ?? is fine.

Robert Dodier wrote:
> On 11/21/09, Kostas Oikonomou <ko at research.att.com> wrote:
> 
>> How about a question mark?  E.g. "x?listp".
>>
>> foo(P(x)) is too much like f(g(x)), function composition.
> 
> Well, it turns out "?" interferes with the use of ? to indicate
> Lisp symbols. But "??" is OK.
> 
> Here's a first attempt to use "??" expressions to indicate
> argument-checking predicates in function definitions.
> 
> foo (x??integerp) := ifactors (x);
> foo (1234);
>  => [[2, 1], [617, 1]]
> foo (a + 1);
>  => foo: expected argument x to satisfy integerp test; found: a + 1
> bar (a ?? lambda ([x], is (abs (x) < 1))) := 1/(1 - a);
> bar (1/2);
>  => 2
> bar (2);
>  => bar: expected argument a to satisfy lambda([x], is(abs(x) < 1))
>                                                    test; found: 2
> 
> 
> What do you think? Patch attached.
> 
> FWIW
> 
> Robert Dodier