Home
Name Modified Size InfoDownloads / Week
nexj-scheme-ecore-adapter 2011-02-03
README.txt 2011-02-03 3.4 kB
nexj-src-oss-scheme-v7.1.13.0.zip 2011-02-02 351.4 kB
nexj-src-oss-scheme-v0.1.zip 2009-10-09 239.6 kB
Totals: 4 Items   594.4 kB 0
Welcome to NexJ Scheme
======================

NexJ Scheme is an open source project providing an efficient and powerful
interpreter for the programming language Scheme that executes in a Java virtual
machine.

NexJ Scheme offers:
   - support for Revised^6 Report on the Algorithmic Language Scheme (R6RS)
   - efficient execution of Scheme code
   - access to the JVM and Java objects directly from Scheme code
   
Join the NexJ Scheme community at http://nexj-scheme.org/


This software is licensed under the Eclipse Public License. See the file
EPL-1.0.txt, included with this distribution.


Getting Started with NexJ Scheme
--------------------------------

To run the REPL interactively first build the JAR file and then invoke it.

C:\> ant nexj-scheme.jar
C:\> java -jar nexj-scheme.jar

Other ant tasks of interest:
- doc : generate Javadoc from the codebase
- clean : remove all of the files generated by the ant tasks 
- nexj-oss-scheme.jar : compile the Java files and bundle the object and source
                        files into the JAR file


Running the NexJ Scheme Interpreter
===================================

Once running, you interact with the NexJ Scheme interpreter simply by typing
Scheme expressions:

   C:\> java -jar nexj-scheme.jar 
   Feb 1, 2011 2:13:21 AM nexj.core.util.log.j2se.J2SELogger log
   INFO: Using system configuration properties
   ; NexJ Scheme
   
   > (+ 2 5)
   ; 7
   
   > "hello world!"
   ; "hello world!"
   
   > (define msg "hello world!")
   ; "hello world!"
   
   > msg
   ; "hello world!"
   
   > (string-length msg)
   ; 12
   
   > (* (string-length msg) 2)
   ; 24


Using Scheme Libraries
======================

You can load a file of Scheme commands using the (load) function. Say for
example you have a file named 'utils.scm' containing:

   (import 'java.lang.System)
   (define (add-them-up a b) (+ a b))
   (define exit (lambda () (java.lang.System'exit 0)))

Then you can use the function add-them-up with:

   C:\> java -jar nexj-scheme.jar 
   Feb 1, 2011 2:15:09 AM nexj.core.util.log.j2se.J2SELogger log
   INFO: Using system configuration properties
   ; NexJ Scheme
   
   > (load "utils.scm")
   ; ()
   
   > (add-them-up 3 4)
   ; 7
   
   > (exit)
   
   C:\>


Invoking Java
=============

With its core being written in Java, the NexJ Scheme engine allows transparent
invocation of Java code while being free of typing. For example:

   (import 'java.util.ArrayList)
   (define numbers (java.util.ArrayList'new))
    
   (for ((i 0)) (< i 10) (set! i (+ i 1))
      (numbers'add i)
   )
    
   (for ((it (numbers'iterator))) (it'hasNext) ()
      (write (it'next))
   )


Determining NexJ Scheme Version
===============================

The version of the NexJ Scheme engine you are running can be accessed from its
engine code:

   (import 'nexj.core.version.Version)
   (nexj.core.version.Version'RELEASE)


Exiting the NexJ Scheme Console
===============================

There are various ways to exit the interpreter. Depending on which console you
are using, you may have different results:

- press Ctrl-C
- press Ctrl-D (possibly followed by ENTER)
- press Ctrl-Z (possibly followed by ENTER)
- run the script: (java.lang.System'exit 0)
- close the console window
Source: README.txt, updated 2011-02-03