Scheme Semantics: Introduction | Print Statement | Declaration/Assignment Statements | Let Statement | Lambda Statement | Define Statement | If Statement
Remainder of this Paper: Scheme Introduction | Lexer | Parser | Continuations

Scheme Lambda Statement


Example of a lambda expression:


((lambda (x)
	(+ x x))
		(* 3 4)) => 24

Lambda expressions to create a local procedure.
Env_0
I/O_0

( lambda
	Env_00                             ;a local environment inside the lambda is created
	(Paramlist)
		Env_01 = Env_00 + (Paramlist)  ;the Paramlist is added to the environment in side the function 							
                                                              ;definition, but is not visible outside, so I call the resulting                        
                                                              ;environment Env_01
	expr
	Val_0                            ;Val_0 results from the evaluation of expr with the given Params
	Env_02 = Env_01 + (Val_0)          ;the newly created Val_0
	Return: Val_0                    ;Val_0 is returned to the toplevel scope for output

Env_0                                  ;the toplevel environment does not change, as any binding changes or 
                                                              ;new variables created inside of the lambda statement are not 	
                                                              ;visible outside
I/O_1 = I/O_0 + (terminal_output:Val_0)