💾 Archived View for idiomdrottning.org › over captured on 2022-06-11 at 22:09:26. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2021-12-03)

-=-=-=-=-=-=-

Over

Update: Now part of brev-separate, with changed semantics and implementation.

brev-separate

For the new version, see fn and over.

Kind of sick of writing (map (lambda ...) ...) every day. Encapsulate common patterns.

Here is over, a macro that defines a lambda that’s immediately curried into a map, taking lists as argument.

((over (x y) (+ x x y)) '(10 20 40) '(3 6 9))

⇒ (23 46 89)

Here is the implementation:

(define-syntax-rule
  (over bindings . body)
  (lambda lis
    (apply map (lambda bindings . body) lis)))