Powered by Pydialect and unpythonic.
from __lang__ import listhell
from unpythonic import foldr, cons, nil, ll
(print, "hello from LisThEll")
my_map = lambda f: (foldr, (compose, cons, f), nil)
assert (my_map, double, (q, 1, 2, 3)) == (ll, 2, 4, 6)
In terms of unpythonic.syntax
, we implicitly enable prefix
and curry
for the whole module.
The following are dialect builtins:
apply
, aliased tounpythonic.fun.apply
compose
, aliased to unpythonic's currying right-composecomposerc
q
,u
,kw
for the prefix syntax (note these are not MacroPy'sq
andu
, but unpythonic's, specifically forprefix
)
For detailed documentation of the language features, see
unpythonic and
unpythonic.syntax
.
Essentially a demonstration of how Python could look, if it had Lisp's prefix syntax for function calls and Haskell's automatic currying.
It's also a minimal example of how to make a dialect based on an ast_transformer
.
Only first-pass macros (outside-in) that should expand after curry
(currently unpythonic provides no such macros) and second-pass (inside-out)
macros that should expand before curry
(there are two, namely tco
and
continuations
) can be used in programs written in the LisThEll dialect.
If you like the idea and want autocurry for a Lisp, try spicy for Racket.
Not intended for serious use.