primedemo /

Filename Size Date modified Message
22 B
1.1 KB
1.6 KB
<!-- -*- markdown -*- -->

The SML Basis Prime Demo

This repository contains a number of code examples demonstrating the use
of the [SML Basis Prime]( (SBP). 
It includes the SBP itself, though it is recommended that you download SBP
from the [main page]( 

With the exception of the examples described immediately below, all the 
examples are designed to be run with SML/NJ using the command 
"`sml <filename>`" while sitting in the root directory 
(the directory where this README file is).  

Using the SBP with different ML implementations

*  **`smlnj/`** (not yet)

*  **`mlton/`** (not yet) 
   MLton can also be executed with the SML/NJ command by running
   "`mlton smlnj/`".

*  **PolyML** (not yet)



Idioms ("applicative functors" in Haskell) are flexible ways of programming 
with state. The `idioms` directeory contains a few examples.

*  **`idioms/evaluation.sml`** - Evaluating expressions in an environment using 
   the environment idiom; demonstrates the use of both the `Idiom` and `IdiomK`
   functors for defining idioms.

*  **`idioms/susp.sml`** - Gives an example of the `Susp` idiom for memoized

*  **`idioms/maybesusp.sml`** - Two idioms can always be composed to create 
   another idiom - a fact that is not true of monads. This file gives a simple
   example of of composing `Susp` with `Maybe` - in both direcions.