-----"S. Newhouse" <sen1 at math.msu.edu> wrote: -----
>> Also, the function 'sublist' might do what you want
>>
>> (%i16) sublist([1,2,3,4,5],'f);
>> (%o16) [2,5]
>>
>>
>Why does the 'non-evaluation' of f in this application of
>sublist work?
>
>It seems that both
>
>sublist([1,2,3,4,5],'f);
>
>and
>
>sublist([1,2,3,4,5],f);
>
>work
>
>Why does this happen?
I don't have an answer to 'why.' But there is a reason to
quote the second argument to sublist. Maxima is OK with:
(%i395) f(x) := is(mod(x,3) = 2)$
(%i396) f : 42$
Now what happens?
(%i397) sublist([1,2,3,4,5],'f);
(%o397) [2,5]
(%i398) sublist([1,2,3,4,5],f);
Improper name or value in functional position: 42
BW