Sujet : Re: Help on simple LISP function
De : Nobody447095 (at) *nospam* here-nor-there.org (B. Pym)
Groupes : comp.lang.lispDate : 23. Jun 2025, 09:29:59
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <103b3a6$14uf8$1@dont-email.me>
User-Agent : XanaNews/1.18.1.6
Frode Vatvedt Fjeld wrote:
I need to write a function that accepts a list and produces a new
list. The new list will keep the numeric, negative atoms at the top
level and remove everything else. In addition it will increment
these new values.
LOOP can do this.
(loop for x in <list> when (and (numberp x) (minusp x)) collect (1+ x))
Gauche Scheme:
(filter-map (every-pred number? negative? (pa$ + 1)) <list>)