Idiomdrottning’s homepage

Over

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)))