[plt-scheme] Local function definition

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Mon Jan 12 09:04:29 EST 2004

Back to Guillaume's original question:

(define (find-short-path graph red-nodes blue-nodes)
   (local ((define (get-siblings loci)
             (map ... ...)))
     (...)))

The local construct is an addition that we made to Scheme (and that 
works in pretty big) so that global define's and local define's had the 
same semantics, including error semantics. That's not the case in plain 
Scheme. It's also possible to pick up a series of definitions and put 
them into a local context after developing them globally with three or 
four keystrokes. And vice versa. I consider this important and do it 
often.

-- Matthias

P.S. As for Dor's question, Scheme has used a context-sensitive 
constraint to define semantics. It inherited this from Algol60 where 
all procedure definitions that occurred between two variable 
definitions or statements were mut rec with each other and "let*" with 
the rest of the world.


Posted on the users mailing list.