zot / Leisure

Polyglot, document-based computing environment. Leisure is very much in flux, right now; please check the readme, below. For a taste of the new version, click the link below, but be warned that it only works in Chrome.
http://zot.github.io/Leisure/?load=elisp/README.org
Other
114 stars 8 forks source link

Pattern matching #39

Open zot opened 11 years ago

zot commented 11 years ago

Type assertions work, but more general patterns would be nice. This is a decent way to allow extending definitions.

zot commented 11 years ago

destructor functions can take a nested structure and return a list of values in order

structures are

struct(type partsList) var lit(value)

the structure for f x::[a [b c] | d] would be: struct('cons' [var struct('cons' [struct('cons' [var struct('cons' var lit(nil))]) var])]

the structure for f x::(person name addr) would be struct('person' [var var])

structures could be type[ ... ] or (type ...), with [] standing for just a cons

Patterns could work in lets, as well