Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Earth is a beta site.


devel / comp.lang.lisp / .Re: Map, Filter, and Reduce in Lisp

SubjectAuthor
o .Re: Map, Filter, and Reduce in LispRobert L.

1
.Re: Map, Filter, and Reduce in Lisp

<t1o0q0$1c0b$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=16998&group=comp.lang.lisp#16998

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!aioe.org!OqeOGrcX7oT7c14m3RGjKw.user.46.165.242.75.POSTED!not-for-mail
From: No_spamming@noWhere_7073.org (Robert L.)
Newsgroups: comp.lang.lisp
Subject: .Re: Map, Filter, and Reduce in Lisp
Date: Sat, 26 Mar 2022 21:32:49 -0000 (UTC)
Organization: Aioe.org NNTP Server
Message-ID: <t1o0q0$1c0b$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Injection-Info: gioia.aioe.org; logging-data="45067"; posting-host="OqeOGrcX7oT7c14m3RGjKw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: XanaNews/1.18.1.6
X-Notice: Filtered by postfilter v. 0.9.2
 by: Robert L. - Sat, 26 Mar 2022 21:32 UTC

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

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor