Readme for husk-scheme-3.5.2.3

husk Scheme

husk is a dialect of Scheme written in Haskell that adheres to the R5RS standard. Advanced R5RS features are provided including continuations, hygienic macros, and a full numeric tower.

husk may be used as either a stand-alone interpreter or as an extension language within a larger Haskell application. By closely following the R5RS standard, the intent is to develop a Scheme that is as compatible as possible with other R5RS Schemes. husk is mature enough for use in production applications, however it is not optimized for performance-critical applications.

Scheme is one of two main dialects of Lisp. Scheme follows a minimalist design philosophy: the core language consists of a small number of fundamental forms which may be used to implement other built-in forms. Scheme is an excellent language for writing small, elegant programs, and may also be used to write scripts or embed scripting functionality within a larger application.

Feature List

husk includes most features from R5RS, including:

As well as the following approved extensions:

And the following R7RS draft features:

Installation

husk may be installed using cabal - just run the following command:

cabal install husk-scheme

Usage

The interpreter may be invoked by running it directly from the command line:

./huski

Alternatively, you may run an individual scheme program:

./huski my-scheme-file.scm

API

A Haskell API is also provided to allow you to embed a Scheme interpreter within a Haskell program. The key API modules are:

For more information, run make doc to generate API documentation from the source code. Also, see shell.hs for a quick example of how you might get started.

Foreign Function Interface

A foreign function interface (FFI) is provided to allow husk to call into arbitrary Haskell code. The interface is currently available via the load-ffi function:

(load-ffi "Language.Scheme.Plugins.CPUTime" "precision" "cpu-time:precision")

load-ffi accepts the following string arguments:

From the previous example, once cpu-time:precision is loaded, it may be called directly from husk just like a regular Scheme function:

(cpu-time:precision)

Any Haskell function loaded via the FFI must be of the following type:

[LispVal] -> IOThrowsError LispVal

See husk's Language.Scheme.Plugins.CPUTime module for an example of how to use the husk FFI.

Development

The following packages are required to build husk scheme:

The tests directory contains unit tests for much of the scheme code. All tests may be executed via the make test command.

The examples directory contains example scheme programs.

Patches are welcome! Please send them via a pull request on github. Also, when making code changes please try to add at least one test case for your change, and ensure that the change does not break any existing unit tests.

License

husk scheme is available under the MIT license.

Credits

husk scheme is developed by Justin Ethier.

The interpreter is based on code from the book Write Yourself a Scheme in 48 Hours written by Jonathan Tang and hosted / maintained by Wikibooks.

If you would like to request changes, report bug fixes, or contact me, visit the project web site at GitHub.