question about sublist



On 4/17/07, Richard Fateman <fateman at cs.berkeley.edu> wrote:
>
> You can do some extra checking, but I think something like this will work:
>
> Extract(input):=block([result:[]],
> map(lambda([x,y], if x*y>0 then result:cons(x,result)),  input,
> rest(input)),
> reverse(result));
>

This will always given an error, since "map" requires all its list arguments
to be the same length.
Perhaps we should have a Lisp-like version of map which stops when the first
list runs out.

Also, map will construct an unnecessary list (which is then thrown away),
but I suppose that is a reasonable trade-off for easier programming.

            -s