Robert L.
unread,Mar 26, 2022, 5:32:54 PM3/26/22You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
Vassil Nikolov wrote:
> | I'm familiar with map/filter/reduce from other languages. But I can't
> | find a simple doc on how to do these in Lisp! What I find perplexing
> | is that I thought that Lisp invented this paradigm?
>
> | What is the simplest way of map / filter / reducing a collection
> | (perhaps a list) in Lisp?
>
> I don't have a reference ready, but note that filtering in Common
> Lisp can be done with REMOVE, REMOVE-IF, and REMOVE-IF-NOT; here is a
> trivial example (one of many possible):
>
> (reduce #'+ (map 'list #'round (remove-if #'symbolp '(foo 1.2 bar 3.4
> baz 5.6))))
> => 10
Instead of CL, let's use a Lisp.
Gauche Scheme:
(fold + 0 (map round (remove symbol? '(foo 1.2 bar 3.4 baz 5.6))))
===>
10.0