[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Another well known list operation is that which applies a predicate to
every item of a list, and deletes those for which the predicate is
false. For a predicate with virtual code p
, such an
application can be coded conveniently in this form,
[[filter
]] p
= ((nil,nil),(nil,(p,nil)))
which is to say that writing ((nil,nil),(nil,(p,nil)))
in
silly
is the same as writing filter p
.
The virtual machine detects code of this form provided that
p
is other than nil
, and evaluates it consistently
with the following properties, causing it to have the meaning that it
does.
([[filter
]] p
) nil
= nil
([[filter
]] p
) (x,y)
=
([[filter
]] p
) y
if p
= x
nil
([[filter
]] p
) (x,y)
=
(x,
([[filter
]] p
) y)
if p x
is a non-nil
tree
This document was generated on December 10, 2012 using texi2html 1.82.