8 ms·
Hy: A dialect of Lisp that's embedded in Python
- isaacimagine 6y agoLisp -> symbolic AI Python -> statistical AI Lisp + Python -> ??? Looks neat :)
- fmakunbound 6y agoThere's a cool book about it here https://leanpub.com/hy-lisp-python https://leanpub.com/hy-lisp-python
- dang 6y agoThe interesting past threads appear to be: Hy – a Python based Lisp dialiect - https://news.ycombinator.com/item?id=24987764 https://news.ycombinator.com/item?id=24987764 - Nov 2020 (1 comment) A Lisp Programmer Living in Python-Land: The Hy Programming Language - https://news.ycombinator.com/item?id=22361821 https://news.ycombinator.com/item?id=22361821 - Feb 2020 (3 comments) A week with Hy - https://news.ycombinator.com/item?id=20645776 https://news.ycombinator.com/item?id=20645776 - Aug 2019 (27 comments) Hy - https://news.ycombinator.com/item?id=20605660 https://news.ycombinator.com/item?id=20605660 - Aug 2019 (141 comments) Some thoughts on hylang (2017) - https://news.ycombinator.com/item?id=19446381 https://news.ycombinator.com/item?id=19446381 - March 2019 (24 comments) Hy: A Dialect of Clojure Embedded in Python - https://news.ycombinator.com/item?id=19277272 https://news.ycombinator.com/item?id=19277272 - March 2019 (13 comments) Hy – A Lisp-flavored Python - https://news.ycombinator.com/item?id=14909786 https://news.ycombinator.com/item?id=14909786 - Aug 2017 (215 comments) Hy - https://news.ycombinator.com/item?id=12893703 https://news.ycombinator.com/item?id=12893703 - Nov 2016 (5 comments) Show HN: HyREPL, Hylang nrepl server - https://news.ycombinator.com/item?id=9869478 https://news.ycombinator.com/item?id=9869478 - July 2015 (7 comments) Live-Coding Blender with Hy - https://news.ycombinator.com/item?id=9850058 https://news.ycombinator.com/item?id=9850058 - July 2015 (30 comments) Hy – A dialect of Lisp that’s embedded in Python - https://news.ycombinator.com/item?id=8696975 https://news.ycombinator.com/item?id=8696975 - Dec 2014 (77 comments) How Hy backported “yield from” to Python 2 - https://news.ycombinator.com/item?id=8641126 https://news.ycombinator.com/item?id=8641126 - Nov 2014 (22 comments) Hy, a Lisp that compiles to Python - https://news.ycombinator.com/item?id=7214400 https://news.ycombinator.com/item?id=7214400 - Feb 2014 (60 comments) Hy: The Logical choice - https://news.ycombinator.com/item?id=7123395 https://news.ycombinator.com/item?id=7123395 - Jan 2014 (12 comments) The State of Hy - https://news.ycombinator.com/item?id=7069781 https://news.ycombinator.com/item?id=7069781 - Jan 2014 (16 comments) Try Hy - https://news.ycombinator.com/item?id=6700103 https://news.ycombinator.com/item?id=6700103 - Nov 2013 (64 comments) Hy - dialect of Lisp that's embedded in Python - https://news.ycombinator.com/item?id=6245191 https://news.ycombinator.com/item?id=6245191 - Aug 2013 (1 comment) First steps with Hy, the Pythonic Lisp - https://news.ycombinator.com/item?id=5924709 https://news.ycombinator.com/item?id=5924709 - June 2013 (28 comments) Others?
- andrewnc 6y agoI played with Hy a few years ago and loved it. You can even use Numpy! I never went much further than surface level stuff, but I wrote about it and would love to jump back in one day.
- fermigier 6y agoCool, I thought it was dead (like the fictional character called, coincidently, "Snake"). I see that active development has restarted 6 months ago, seemingly. Kudos to everyone involved, specially @Kodiologist who seems the main contributor over the recent period. (Shameless plug: more functional languages that look like Python, or compile to one of the Python VMs: https://github.com/sfermigier/awesome-functional-python#languages https://github.com/sfermigier/awesome-functional-python#lang... ).
- nerdponx 6y agoYou should add Hissp to this list: https://hissp.readthedocs.io https://hissp.readthedocs.io
- aasasd 6y agoNote that this is not Lisp interpreted in Python, but transpiled into Python AST on the fly. Which is how Lisps should be implemented on top of modern environments. (IIRC the ‘gisp’ project takes that approach even further: it transpiles a Lisp to the AST, and then spits out Go code that would generate the same AST: https://github.com/jcla1/gisp https://github.com/jcla1/gisp)
- kubb 6y agoThe mapping of the AST onto lisp plus an implementation of macros would solve all the issues with Go verbosity, lack of generics, error handling, and probably much more. But it would have a lot of braces so junior programmers wouldn't be able to use it and so it's a non starter.
- aasasd 6y agoYou can translate an analogous syntax of your choosing into the same lists =) E.g. something Python-ish or Yaml-ish, or Rebol.
- gilch 6y agoSee Hebigo's Python-like approach: https://github.com/gilch/hissp#hebigo https://github.com/gilch/hissp#hebigo
- mumblemumble 6y agoThis seems a bit like the story with Clojure vis-a-vis Java, to me. Yes, Clojure does a lot to clean up Java's verbosity, flaky implementation of generics, etc. But I don't think that's actually because Clojure is a Lisp; I think it's mostly because Clojure is a dynamic language. For example, Clojure largely resolves Java's generics situation by simply not needing them in the first place. That worked for Java, where a lot of people are stuck on the JVM for legacy reasons, but yearning to at least be able to work in a more ergonomic language. Go lives in a different social environment, though. Nobody's stuck on Go because they've got 25 years' worth of massive legacy Go monoliths that they can't just chuck out the door. They're on Go because Go is what they want. And I'm pretty sure, given that they're invested in Go, that a dynamic language with a heavy focus on metaprogramming is approximately the opposite of what they want.
- deleted 6y ago[deleted]
- qwerty456127 6y agoDear JetBrains, can we have Hy supported in PyCharm please?
- ngcc_hk 6y agoLisp-1 is scheme. But guess basically a Python ast generator ... ?
- nerdponx 6y agoYes and yes.
- Foxboron 6y agoKaren Rustad Tölva drew the Hy logo, Cuddles the cuttlefish, and later the Rust mascot too, Ferris the Rustacean. You can probably see they are in the same style :) Paul Tagliamonte and the Hy contributors is what got me into F/OSS many years ago, and even if I haven't actively contributed the past 6-7 years I'll have a veryvery sweet spot for the project<3
- jwandborg 6y agoI was involved in GNU MediaGoblin at the time (circa 2011), and both krustad and paultag spanned those communities. I have fond memories of the time. I also remember your name!
- blumomo 6y agoCan anyone tell a story from using Hy in production?
- billfruit 6y agoOne thing I remember from trying it about 2 years ago, was that its syntax conventions etc was similar to clojure but different in some aspects, made it a bit of a chore for someone used to Clojure to keep track of the differences while using Hy.
- agentultra 6y agoSorry about that. I was an early contributor and a Common Lisp programmer in my spare time when I worked on the early iterations of Hy. I think it's been mostly papered over now but you still have the :keyword named parameter.
- timonoko 6y agoSomebody should try the Mulisp approach. There was simple set of rules to transform Algol-like syntax to Lisp syntax. You would not need to learn Lisp of any kind, you just add some parenthesis to a Python line and it becomes linked list data for a macro definition. And with one-to-one mapping, we can transform the macro output to back to regular Python line.
- gilch 6y agoNot sure how close Hebigo gets to that idea: https://github.com/gilch/hissp#hebigo https://github.com/gilch/hissp#hebigo
- Arjuna144 6y agoThis is so cool! I love it. I would only have to convince my boss to allow me to use it in some modules of our python project....
- asoneth 6y agoIs it possible to losslessly translate from Hy or Python to the Abstract Syntax Tree and back? That is, is there way to have a code viewer that, instead of highlighting syntax, changes it to another syntax on the fly? Could each member of a development team look at the same piece of code but the first sees Lisp syntax, the second sees Python, a third sees a C-style syntax, and a fourth has a mishmash of their own design? Obviously there are language differences that go beyond syntax, but the learning curve of reading unfamiliar syntax often seems to be a sticking point for people considering/learning a new language. For example, someone who has experience in curly-brace languages may initially have trouble adapting to the use of indentation in Python or parentheses in Lisp.
- aasasd 6y agoLisp and Python have different semantics, even between Python and Hy: an obvious one is that Lisp's `if` and all other statements are expressions. Coming up with a syntax is not the hard part. A couple gotchas that basically all Lisps-on-other-languages have to keep in mind are: variables, since Lisps usually don't have the same scopes as anything imperative (with the ‘let’ blocks); and function names and possibly functions-as-variables, since Lisps are liberal with both. As a rule, you'd have to implement your own variable scopes and name mangling for where the semantics don't match. Plus macros are an obvious addition—IIRC Hy still has them in separate files (though I might confuse that with Fennel). And if you wish to have keywords as a separate type, that's usually entirely on you—afaik Clojure went full-in here, others not so much. > reading unfamiliar syntax often seems to be a sticking point for people considering/learning a new language Precisely the opposite of my and many other people's experience. Remembering whether blocks are delimited with braces, indentation or e.g. ‘then/end’ is a no-brainer. Learning the subtle differences in semantics, the type system, the library, package system and build environments—that's the bitch. Consider that there are dozens of even kinda-popular Lisps, despite them not having much syntax in the first place. They don't just differ in the function names. You seem to be imagining a ‘universal-ish intermediate language’, so to say, that would permit people with different experience to quickly adapt to an environment of a different language. Not possible, because a) semantics is where the difference is, you'd need a full-blown language translator, which still can be lossy or incomplete (e.g. no types in your standard Lisp); b) one would still have to deal with all the non-language parts of the environment, like the library, packages, the build system.
- frou_dh 6y agoPure Data (the venerable audio software, sibling of Max/MSP) has its package manager (for plugins) written in Hy. I found that to be a bizarre sighting of it in the wild.
- mullikine 6y agoThis exists now, and it's awesome. https://github.com/clj-python/libpython-clj https://github.com/clj-python/libpython-clj
- Arjuna144 6y agohahaha, even better! Man sad thing this isn't going through the roof yet! Amazing!
- mark_l_watson 6y agoI am currently writing an AI book using Clojure examples. I am using this library, as well as DL4J, etc. I am a Common Lisp developer, but I hope that my Clojure book will be useful. I wrote a short Hy language book, mostly as a learning activity for myself. You can get a free copy on the books page of my personal web site [1]. [1] https://markwatson.com https://markwatson.com EDIT: to get started with libpython-clj go to Carin Meier’s great example repo https://github.com/gigasquid/libpython-clj-examples https://github.com/gigasquid/libpython-clj-examples Also, libpython-clj can be tricky setting up so I use a dedicated GCP VPS that I spin up just for using this library.
- mullikine 6y agoI'm looking forward to your Clojure AI book. Your books look amazing. Thanks for sharing.
- mark_l_watson 6y agoThanks! I hope to have the first edition out in 6 to 8 weeks. As always, there will be a free PDF download on my site.
- masijo 6y agoThis isn't an "actual" Lisp, it's just Python with S-expressions.
- gilch 6y agoWhat else does it need to be a Lisp?
- paultopia 6y agoDid they finally get `let` working? I remember it wasn't for a long time, which seems like a deal-breaker for a lisp...
- gilch 6y agoYes, but you have to (require) it: https://docs.hylang.org/en/master/api.html#module-hy.contrib.walk https://docs.hylang.org/en/master/api.html#module-hy.contrib...
- Decabytes 6y agoI know a lot of people are going to poo poo on this as "not a lisp" but I think it makes lisps more approachable for a python programmer who is not used to them. I used experimented with Hy a few years ago and I felt that it made it easier to write recursive functions (even if python doesn't have tail call optimization). Being able to bind multiple values to multiple variables was nice, and I believe I could get multi-line lambdas in Hy as well. And it wouldn't be great but if someone new Python by not Hy, there was always hy2py to convert your Hy program back to Python. It was also nice to be able to write some sexps but still have the entire python ecosystem. Doing dataframe manipulation through parens with pandas made me laugh, and while it wasn't always clear how to translate my python code into Hy It was definitely waay easier then learning an entirely new language. I eventually moved onto Racket after I ran into some issues with Hy being "not a lisp" but Hy certainly made Racket easier for me to grok after playing around with it
- mumblemumble 6y agoSide comment: Python doesn't have TCO, but Hy does have the loop/recur macros in its contrib library. They give you a version of tail recursion that looks a bit odd at first, but quite nice once you get used to it.
- gilch 6y agoHy's loop/recur had a serious bug last I checked: https://github.com/hylang/hy/issues/1465 https://github.com/hylang/hy/issues/1465 But see the @loop decorator from Drython for how to do this in Python: https://github.com/gilch/drython/blob/eb1773c14060e31e2544f5fb69dd31621d0bc291/drython/statement.py#L1003 https://github.com/gilch/drython/blob/eb1773c14060e31e2544f5...
- andybp85 6y agoI worked through the first four chapters of The Little Schemer in Hy a bunch of years ago: https://github.com/andybp85/hyLittleSchemer https://github.com/andybp85/hyLittleSchemer I moved on to Racket shortly after (which I sadly don't use nearly as much as I should these days), but that work definitely made me a far better programmer!
- elyseum 6y agoSomebody took the Make A Lisp challenge (https://github.com/kanaka/mal https://github.com/kanaka/mal) quite serious :D
- gilch 6y agoThere even a mal in Hy! https://github.com/kanaka/mal/tree/master/impls/hy https://github.com/kanaka/mal/tree/master/impls/hy