22 Mar 2004 mslicker   » (Journeyer)

ML and Forth

I think ML semantics could be implemented in Forth, the main concept that would be needed is a local envrironment. Forth, at least the one I use, only has a global environment.

Map in Ocaml:

let rec map f l = if l = [] then [] else f (hd l) :: map f (tl l)

could be expressed:

: map {l f} l [] = if [] else l hd f a f l tl map :: ;

a would be the apply function. {l f} would denote a binding, binding the top stack element to l, the second stack element to f. In colorForth, :, {}, ;, could be replaced by color.

I don't have any interest in seeing this through at the moment, just a thought for now.

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!