[Larceny-users] R6RS Libraries

William D Clinger will at ccs.neu.edu
Sat Oct 13 21:35:06 EDT 2007


Ray Racine wrote:
> If anyone can post a small example of how to use R6RS libraries/programs
> in Larceny I'd appreciate it.

At the moment, you need to know about an
as-yet-undocumented (because I've been doing
it manually and expect it to change slightly
before it becomes part of the v0.95 release)
addition to the system build process.

After you have built the current development
system following the usual instructions in
doc/HOWTO-BUILD, you'll need to compile the
R6RS runtime as follows:

----

% pushd lib/R6RS
[R6RS]% larceny
Larceny v0.94 "Doomsday Device" (**but really the current system!**)

> (load "r6rsmode.sch")

> (larceny:compile-r6rs-runtime)

> (exit)

----

After you have done the above, you should be
able to run simple R6RS top-level programs in
Larceny's R6RS-compatible mode as documented at
http://larceny.ccs.neu.edu/larceny-trac/wiki/ConformanceModes

(To find out which of the R6RS standard libraries
haven't yet been added to Larceny's current
development system, search for FIXME in
lib/R6RS/r6rs-standard-libraries.sch.  Also,
some features (such as set-port-position!) aren't
implemented yet even though most other features
of the relevant libraries are present.)

If you're running a Unix machine (typically
Linux, MacOS X, or Solaris) and Larceny's root
directory is in your execution path, then you
should be able to execute Scheme scripts as
documented in non-normative appendix D of the
R6RS.

Examples:

% larceny -r6rs -program hello.sch
Hello world!

% scheme-script hello.script

% ./hello.script
Hello world!

where hello.sch and hello.script contain the
obvious code:

---- hello.sch ----
(import
  (rnrs base)
  (rnrs io simple))

(display "Hello world!")
(newline)

---- hello.script ----
#!/usr/bin/env scheme-script

#!r6rs   ; (this line is optional)

(import
  (rnrs base)
  (rnrs io simple))

(display "Hello world!")
(newline)

----

There is nothing magic about the ".sch" and
".script" suffixes in the examples above.

Will



More information about the Larceny-users mailing list