What is Nostr?
graywolf /
npub1nef…uq7k
2024-10-01 23:11:15

graywolf on Nostr: If I want to create two lists from a single map, is there a nice pattern for it? Let ...

If I want to create two lists from a single map, is there a nice pattern for it?

Let us assume this as an example:

(let* ((sum+prod (map (λ (n)
(cons (+ 2 n) (* 2 n)))
(iota 10)))
(sum (map car sum+prod))
(prod (map cdr sum+prod)))
#t)

Is there an elegant way to re-write it using just one iteration?

#scheme #guile #lisp
Author Public Key
npub1nefrrwuefssnkj6mc8gjkqfxp0z2sgutw7eclqw3h5ns6qm7g7js58uq7k