1. Rob Simmons
  2. primedemo


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](http://bitbucket.org/robsimmons/prime) (SBP). 
It includes the SBP itself, though it is recommended that you download SBP
from the [main page](http://bitbucket.org/robsimmons/prime). 

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/demo.cm`** (not yet)

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

*  **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.