We have variants of Python that can use Python libs: welcome to
Dogelang, Mochi, Hy, Coconut and Hask.
We can also have languages that target the Python platform without
being necessarily compatible with Python, and domain-specific
languages.
For more ressources related to functional programming in Python, see
the Awesome Functional Python
list.
Table of Contents
Variants of Python. They can use Python libs.
The following languages can make use of the Python libraries.
Dg - it's a Python ! No, it's a Haskell !

Dogelang |
--- | ---
sources |https://github.com/pyos/dg
doc | https://pyos.github.io/dg/
v1 ? | yes, april 2015
created | june, 2012
- compiles to CPython 3.4. Dg is an alternative syntax to Python 3.
- compatible with all the libraries
- runs on PyPy
Language features
- function calls without parenthesis:
print "wow" "two lines" sep: "\n"
print $ "> {}: {}".format "Karkat" "Reference something other than Doge"
- pipe and reverse pipe (on the same line, unlike Mochi)
print <| 'What' + 'ever.' : 'This is the same thing ' + 'in a different direction.' |> print
- function notation (arrow
-> notation)
function = arg1 arg2 -> : print (arg1.replace "Do " "Did ") arg2 sep: ", " end: ".\n"
function "Do something" "dammit"
- infix notation (with backticks)
- function composition (with
<-)
- first class operators
f = (+)
f 1 2 == 3
- partial application (and
bind is functools.partial)
f = (2 *)
f 10 == 20
new functional builtins: foldl and foldl1, scanl, flip,
takewhile and dropwhile (from itertools), take and drop,
iterate, head and fst, tail, snd, last and init.
decorators don't need special syntax, they're just called with a
function
wtf = the~decorator~ $ ->
Install
pip3 install git+<https://github.com/pyos/dg>
Editors
Editor |
--------- | --------------------------------------------------------------------------------
Gedit | https://github.com/pyos/dg-gedit/
Sublime | https://github.com/pyos/dg-textmate/
Pygments support.
Example projects
Project |
--- | ---
dogeweb , a functional web framework atop asyncio | https://pyos.github.io/dogeweb/
Hissp - It's Python with a Lissp!

Hissp is a modular Lisp implementation that compiles to a functional subset of Python—Syntactic macro metaprogramming with full access to the Python ecosystem!
Hissp |
-------------|------------------------------------------------------------------------
sources | https://github.com/gilch/hissp
doc | https://hissp.readthedocs.io/
v1 ? | no, v0.2 as of May 2021
created| 2019
discuss | gitter
The Hissp compiler is written in Python 3.8.
Language features
The Hissp compiler should include what it needs to achieve its goals, but no more. Bloat is not allowed.
Hissp compiles to an unpythonic functional subset of Python.
Hissp's basic macros are meant to be just enough to bootstrap native unit tests and demonstrate the macro system. They may suffice for small embedded Hissp projects, but you will probably want a more comprehensive macro suite for general use.
You do not need Hissp installed to run the final compiled Python output
(defmacro attach (target : :* args)
"Attaches the named variables as attributes of the target.
Positional arguments use the same name as the variable.
Names after the ``:`` are key-value pairs.
"
(let (iargs (iter args)
$target `$#target)
(let (args (itertools..takewhile (lambda (a)
(operator..ne a ':))
iargs))
`(let (,$target ,target)
,@(map (lambda (arg)
`(setattr ,$target ',arg ,arg))
args)
,@(map (lambda (kw)
`(setattr ,$target ',kw ,(next iargs)))
iargs)
,$target))))
Hy - A dialect of Lisp that's embedded in Python

Hy |
-------------|------------------------------------------------------------------------
sources | https://github.com/hylang/hy/
doc | http://hylang.org/
v1 ? | no
created| december, 2012
online REPL | https://try-hy.appspot.com/
discuss | google group
IRC | hy on freenode
- Hy compiles to Python bytecode (AST)
- Hy can use python libraries, and we can import a Hy module into a
Python program.
Language features
- it's python: context managers, named and keyword arguments, list
comprehensions,...
- macros, reader macros
- threading macros (like Clojure), with
-> and ->> (similar to
pipes)
(-> (read) (eval) (print) (loop))
(import [sh [cat grep wc]])
(-> (cat "/usr/share/dict/words") (grep "-E" "^hy") (wc "-l")) ; => 210
(require hy.contrib.anaphoric)
(list (ap-map (* it 2) [1 2 3])) ; => [2, 4, 6]
- fraction literal (like Clojure)
- unicode support (I mean for symbols)
- pattern matching (in libraries, like
Hyskell)
- monads (in libraries, like Hymn)
Install
pip install hy
Editors
Editor |
------- | --------------------------------------------------------------------------
Emacs | https://github.com/hylang/hy-mode
All | lisp modes for any editor
Example projects
Project |
--- | ---
Github trending | https://github.com/trending/hy
Live coding Blender | https://github.com/chr15m/blender-hylang-live-code
Good reads
Title |
--- | ---
How Hy backported "yield from" to Python 2 | http://dustycloud.org/blog/how-hy-backported-yield-from-to-python2/
Basilisp - a Clojure-compatible(-ish) Lisp dialect targeting Python 3.8+
Basilisp |
---------|----------------------------------------------------------------
sources |https://github.com/basilisp-lang/basilisp
doc | https://basilisp.readthedocs.io/en/latest/
v1 ? | no (as of 2024, Jan) but "generally stable at this point"
created | initial development release in 2018
Language features
- Immutable data structures, backed by Immutables and Pyrsistent
- Strong emphasis on functional programming concepts
- Access to the vast array of existing Python libraries
- Seamless interoperability between Python code and Basilisp code
- Sophisticated REPL for REPL-based development
Planned features:
Basilisp is still young and so lacks many features that more mature languages and runtimes might include. There are many such planned features that will hopefully improve the ergonomics of the project for new developers.
fundamental differences and omissions in Basilisp that make it differ from Clojure:
- Basilisp does not include Ref types or software transactional memory (STM) support.
- Basilisp does not include Agent support (support is tracked in #413).
- All Vars are reified at runtime and users may use the binding macro as in Clojure.
- Support for Clojure libs is planned.
- Type hints may be applied anywhere they are supported in Clojure (as the :tag metadata key), but the compiler does not currently use them for any purpose.
(def
^{:doc "Returns the second element in a Seq."
:arglists '([seq])}
second
(fn* second [seq] (first (rest seq))))
Mochi - Dynamically typed programming language for functional programming and actor-style programming
Mochi |
---------|----------------------------------------------------------------
sources |https://github.com/i2y/mochi
doc | many examples
v1 ? | no
created | v0.1 on december, 2014
- translates to Python3's AST/bytecode
Language features
- Python-like syntax
- pipeline operator (multiline ok)
range(1, 31)
|> map(fizzbuzz)
|> pvector()
|> print()
- tail-recursion optimization (self tail recursion only)
- no loop syntax
- re-assignments are not allowed in function definition
- persisent data structures (using Pyrsistent)
- Pattern matching / Data types, like algebraic data types
- Syntax sugar of anonymous function definition (
-> notation and
$1 for the arguments)
- Actor, like the actor of Erlang (using Eventlet)
- Macro, like the traditional macro of Lisp
- Anaphoric macros