-
Notifications
You must be signed in to change notification settings - Fork 0
License
dshep/nexj-src-oss-scheme-v7
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
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
About
No description, website, or topics provided.
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published