Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Hylang - A Python powered Lisp AND a Lisp power...

Hylang - A Python powered Lisp AND a Lisp powered Python

Hylang is a lisp that is written in python that compiles down to python itself. This is a talk given during the Chennaipy February meetup 2015.

Shrayas Rajagopal

February 28, 2015
Tweet

More Decks by Shrayas Rajagopal

Other Decks in Programming

Transcript

  1. Hy!

  2. 1+1

  3. (+ 1 2 3 4 5) 1 + 2 +

    3 + 4 + 5 Infix S-Expressions
  4. Dialects Arc, AutoLISP, Clojure, Common Lisp, Emacs Lisp, EuLisp, Franz

    Lisp, Interlisp, ISLISP, LeLisp, LFE, Maclisp, MDL, Newlisp, NIL, Picolisp, Portable Standard Lisp, Racket, Scheme, SKILL, Spice Lisp, T, XLISP, Zetalisp
  5. Dialects Arc, AutoLISP, Clojure, Common Lisp, Emacs Lisp, EuLisp, Franz

    Lisp, Interlisp, ISLISP, LeLisp, LFE, Maclisp, MDL, Newlisp, NIL, Picolisp, Portable Standard Lisp, Racket, Scheme, SKILL, Spice Lisp, T, XLISP, Zetalisp
  6. def say_hello(name): print "Hello", name if __name__ == "__main__": say_hello("Python")

    (defn say_hello [name] (print "Hello" name)) (if (= __name__ "__main__") (say_hello "python")) python hylang Hello, python
  7. python hylang Data Structures >>> [1,2,3] >>> {"foo": 1, "bar":

    2, "baz": 3} >>> (1,2,3) => [1 2 3] => {"foo" 1 "bar" 2 "baz" 3} => (, 1 2 3)
  8. python Conditionals if (foo > 5): print "foo more than

    5!" else: print "foo less than 5!"
  9. python hylang Conditionals if (foo > 5): print "foo more

    than 5!" else: print "foo less than 5!" (if (> foo 5) (print "foo more than 5!") (print "foo less than 5!"))
  10. python Conditionals (more) if (foo > 7): print "Too much"

    elif (foo < 7): print "Too less" else: print "ok :)"
  11. hylang Conditionals (more) (cond [(> foo 7) (print "Too much")]

    [(< foo 7) (print "Too less")] [true (print "ok :)")])
  12. python (usemath.py) hylang (hymath.hy) Interop! (defn square [x] "returns square

    of x" (* x x)) import hy import hymath print hymath.square(8)
  13. hylang is a pythonic lisp 1 Has great interop with

    python 2 Great excuse to learn Lisp 3 Recap
  14. hylang is a pythonic lisp 1 Has great interop with

    python 2 Great excuse to learn Lisp 3 A new language 4 Recap