Shen¶
Shen is a portable functional programming language that offers
- pattern matching,
- λ calculus consistency,
- macros,
- optional lazy evaluation,
- static type checking,
- an integrated fully functional Prolog,
- and an inbuilt compiler-compiler.
Shen has one of the most powerful type systems within functional programming. Shen runs under a reduced instruction Lisp and is designed for portability. The word ‘Shen’ is Chinese for spirit and our motto reflects our desire to liberate our work to live under many platforms.
Shen includes sources and is absolutely free for commercial use. It currently runs under CLisp and SBCL, Clojure, Scheme, Ruby, Python, Java and Javascript.
The official guide to Shen, The Book of Shen, can be bought here.
(0-) (define super
[Value Succ End] Action Combine Zero ->
(if (End Value)
Zero
(Combine (Action Value)
(super [(Succ Value) Succ End]
Action Combine Zero))))
@{super}@
(1-) (define for
Stream Action -> (super Stream Action do 0))
@{for}@
(2-) (define filter
Stream Condition ->
(super Stream
(/. Val (if (Condition Val) [Val] []))
append
[]))
@{filter}@
(3-) (for [0 (+ 1) (= 10)] print)
#{0123456789}#@{0}@
(4-) (filter [0 (+ 1) (= 100)]
(/. X (integer? (/ X 3))))
@{[0 3 6 9 12 15 18 21 24 27 30 42... etc]}@
