[plt-scheme] annotated lambda

From: Jens Axel Søgaard (jensaxel at soegaard.net)
Date: Thu Jul 26 07:22:38 EDT 2007

Tom Schouten wrote:

> This indicates 2 elements on the stack. The number 1 and the quoted
> program (1 +). The language elements themselves are represented as
> scheme functions (stack -> stack). I.e. the function '(1 +)' might be
> (lambda (a . stack) (cons (+ 1 a) stack)), and the function '1' might be
> (lambda stack (cons 1 stack))

> So my question is, how can i annotate the functions I get in the end, to
> associate them to their original source code, so my 'print stack' operation
> still works?

You could use structures instead of functions to represent the forth
language elements, since structures can can be used as procedures:

<http://download.plt-scheme.org/doc/370/html/mzscheme/mzscheme-Z-H-4.html#node_sec_4.6>

-- 
Jens Axel Søgaard





Posted on the users mailing list.