[plt-scheme] How to apply a multi-argument function to each element of a list

From: Synx (plt at synx.us.to)
Date: Thu Mar 4 03:10:30 EST 2010

Matthias Felleisen wrote:

> (define (encrypt n m)
>   (local ((define (encrypt-message msg) ... msg ... n ... m ...))
>     encrypt-message))

I'm fairly sure "local" isn't required in most cases. The "define"
syntax itself has an implied "local" section, thus:

(define (encrypt n m)
  (define (encrypt-message msg) ...)
  encrypt-message)

You still can't mix defines and statements without defines, but I'm
pretty sure you don't need to include the "local" syntax unless you're
doing something weird.

Also,

(define (encrypt n m)
  (λ (msg)
     ...))


Posted on the users mailing list.