Shen is a portable functional programming language by Mark Tarver. It is the successor to the award-winning Qi language, with the added goal of being highly portable across platforms.
More information is available on the official website.
(define filter
_ [] -> []
F [X | Xs] -> [X | (filter F Xs)]
where (F X)
F [_ | Xs] -> (filter F Xs))
(define element?
_ [] -> false
X [X | _] -> true
X [_ | Y] -> (element? X Y))
(define walk
_ [] <- (fail)
F [X | _] -> X where (F X)
F [_ | Y] -> (walk F Y))
(define y-combinator
F -> ((/. X (X X))
(/. X (F (/. Y ((X X) Y))))))
(let F (freeze (output "Hello!"))
(thaw F))
> "Hello!"
(tc +)
(define map
{(A --> B) --> (list A) --> (list B)}
_ [] -> []
F [X | Xs] -> [(F X) | (map F Xs)])
(map (+ 1) ["a" "b" "c"])
> type error
(datatype maybe-type
_____________________
none : (maybe A);
X : A;
_____________________
(some X) : (maybe A);
M : (maybe A);
_____________________
(unwrap M) : A;)
(defprolog member
X [X | _] <-- ;
X [_ | Y] <-- (member X Y);)
(prolog?
(member X [1 2 3])
(member X [3 4 5])
(return X))
> 3
(define bit?
B -> (element? B [0 1]))
(defcc <b>
B <b> := [B | <b>] where (bit? B);
B := [B] where (bit? B);)
(defmacro infix-macro
[X + Y] -> [+ X Y]
[X * Y] -> [* X Y])