[virtmach] lambda
btanksley@hifn.com
btanksley@hifn.com
Wed, 8 Dec 1999 13:23:11 -0800
> From: Stephen Pelc [mailto:sfp@mpeltd.demon.co.uk]
> Subject: Re: [virtmach] lambda
> David Rush wrote:
> > Ceri Storey <cez@nomorespam.freeserve.co.uk> writes:
> > > in a bytecode based VM, is it possible to have a lambda
> > > opcode? (as in
> > > scheme/lisp/lambda calculus) woud it be a case of pushing a pre
> > > comipled function onto the stack (from a vector of
> > > constants, as in
> > > emacs) or can you create one from the nomal 'stream' of
> > > instructions?
I'm not sure what a 'lambda' instruction would do. I suppose it would
convert a sequence of data plus a function description into a sequence of
instructions? This seems to be a better task for a language than for a VM,
although controlled dynamic code creation would be nice for a VM.
> > Others may disagree, but I don't think so. At least not in the way
> > that you have phrased the question (Although Forth machines in
> > particular probably *can*, compiler interaction is strange and
> > wonderful in their world). The problem is that identifying
> This isn't my field at all, but given the comment that Forth
> machines probably can, I don't understand why Forth machines
> rather than others should be capable of this.
I would expect the Forth-VM equivalent of the lambda instruction to be
something like COMPILE. Forth words/functions don't have descriptions, and
there are no variable names, so lambda calculus is irrelevant. (Come to
think of it, the lack of variable names might make lambda itself
irrelevant.)
Grin -- the Y-combinator, which is taught in every Scheme book as a big,
convoluted patch of code, is only a couple of words in Forth. IIRC, it's
something like "DUP EXECUTE"
> Stephen Pelc, sfp@mpeltd.demon.co.uk
-Billy