[Larceny-users] Digression from ( Explicit renaming library)

AndrevanTonder andre at het.brown.edu
Wed Aug 1 14:45:13 EDT 2007


On Wed, 1 Aug 2007, Felix wrote:

> % ./larceny
> Larceny v0.94 "Doomsday Device" (Aug  1 2007 12:51:44,
> precise:Linux:unified)
> larceny.heap, built on Wed Aug  1 12:53:28 EDT 2007
>
> > (current-directory "lib/VanTonderMacros")
> 0
>
> > (load "examples.scm")
> ... (mucho output elided) ...

Let me just remark that this currently only works once per Larceny session.
Since loading the expander redefines the Larceny make-parameter, the second 
time it is loaded in the same session it tries to re-redefine it.
If you would like to do repeat runs or add your own examples, I would recommend 
commenting out the loads at the top of examples.scm once you have run it 
once, or simply editing and loading your own example file of the format

   ($ex:repl '( <form> ... ))

See examples.scm.

> Note that the $ex:repl procedure provided by Andre isn't exactly what
> I would consider an interactive repl; I consider it more of a whole
> program eval procedure.

Well, not exactly any more:  If you would like to type things interactively
at the repl, you can just wrap them in $ex:repl as follows:

> ($ex:repl '( (import (rnrs base)) ))
unspecified

> ($ex:repl '( (cons 1 2) )  ; uses cons from (rnrs base) 
(1 . 2)

and so on (obviously any eventual integration would automate the call to
$ex:repl).  You may even enter a library definition at the prompt wrapped
like this and import it at another prompt, but it is probably easier to
just edit and load an example file as recommended above.

Note that the namespace of stuff wrapped in $ex:repl is orthogonal to
the Larceny toplevel namespace.  In other words

> (define x 1)

> ($ex:repl '( x ))   ==> unbound identifier

It would have worked if the definition was also wrapped in $ex:repl.

By the way, using the Larceny interpreter for this is very slow on my
machine in comparison with the other two implementations.  This will obviously 
change if and when I can figure out how to compile the expander on Larceny
(I have problems loading a compiled version of the expander that seems to be 
related to an issue with uses of define-record-type from srfi-9).  In the 
meantime, if the lack of speed frustrates you, it may be easier to use 
MzScheme or Petite for experiments in the meantime.

Andre




More information about the Larceny-users mailing list