💾 Archived View for idiomdrottning.org › over captured on 2024-08-31 at 14:21:30. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2021-12-03)
-=-=-=-=-=-=-
Update: Now part of brev-separate, with changed semantics and implementation.
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)))