Skip to content

superwesman/pyojure

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pyojure

make python more like clojure

pyojure is pure joy

Usage

>>> from pyojure import *
>>> mapv(print, dir())
>>> assoc({"this": "is"}, "very", "cool")
{'this': 'is', 'very': 'cool'}
>>> comp(str, inc, int)('123')
'124'
>>> list(partition(2, [1,2,3,4,5,6,7,8,9]))
[[1, 2], [3, 4], [5, 6], [7, 8], [9]]

Doc

>>> import pyojure
>>> help(pyojure.core)

Caveats

  • Clojure has much more liberal syntax for identifiers. Standard naming transpositions are attempted.
    • - -> _ e.g. every-pred -> every_pred
    • ? predicate suffix -> is_/has_/etc. predicate prefix e.g., odd? -> is_odd
  • Some Clojure function names indicate types that are known by different names in Python.
    • E.g., the v in mapv refers to the Clojure vector type, which is equivalent to a Python list
    • Both names are provided for now i.e., mapv == mapl

About

make python more like clojure

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages