11 ms·
Hy
- owenversteeg 7y agoSounds very interesting! Anyone here who uses (or tried) Hy? I'm curious how easy it is to use some arbitrary thing in Python (library, code snippet, etc) in particular.
- shakna 7y agoHy makes it trivial to use Python stuff. Like Django [0]. Most things are just a (import x) away. [0] https://github.com/paultag/djlisp/tree/master/djlisp https://github.com/paultag/djlisp/tree/master/djlisp
- rcarmo 7y agoI wrote https://github.com/rcarmo/sushy https://github.com/rcarmo/sushy on it before they moved let to contrib. (I later ported it back to pure Python 3, because I couldn’t move forward while Hy was in flux) If let was “fixed”, I’d probably move back to Hy.
- nerdponx 7y agoIt's great, for me it's basically Python but better. Downsides: - On CPython, the generated Python code tends to be noticeably slower in hot loops than the equivalent "native" Python code. I haven't done any testing with PyPy. - Can't really use it at work since nobody will know how to read it. My conclusion is: it's fun, it's Lisp, and it's Python. For personal projects and small standalone tools it's perfect.
- thanatropism 7y agoI'm (perhaps irresponsibly) mixing some of it inside a medium-sized Python codebase. The one thing that doesn't work is autodoc/Sphinx. Otherwise it's all there, and quite pleasant to work with given a rainbow-parenthesis extension and Parinfer.
- tim333 7y agoI played around with Hy and found it fun but I'm not sure anyone is using it for anything serious?
- akhong 7y agoDNS error for the docs http://docs.hylang.org/ http://docs.hylang.org/ :/
- zdkl 7y agoNot sure if it's quite the same thing, but this is still up https://hy.readthedocs.io/en/stable/ https://hy.readthedocs.io/en/stable/
- rmbeard 7y agoIt shows build status: build failing.
- theemathas 7y agoArchive.org link https://web.archive.org/web/20190714180208/http://docs.hylang.org/en/stable/ https://web.archive.org/web/20190714180208/http://docs.hylan...
- pixelmonkey 7y agohy was first introduced to me at PyCon 2013 in a lightning talk by @paultag, the language's creator. It was a very fun lightning talk. You can still watch it online here: https://youtu.be/1vui-LupKJI?t=968 https://youtu.be/1vui-LupKJI?t=968 I remember that day pretty clearly because in the same lightning talk session, Solomon Hykes introduced the Python community to docker, while still working on dotCloud. This is what I think might have been the earliest public and recorded tech talk on the subject. https://youtu.be/1vui-LupKJI?t=1579 https://youtu.be/1vui-LupKJI?t=1579 This was also the same PyCon that Eben Upton opened with a keynote to discuss the mission of Raspberry Pi, while also announcing that each of the 2,500 attendees would receive a free physical Raspberry Pi at the conference. It was a pretty darn good year of PyCon; 2013 was apparently a good vintage for open source tech with Python connections.
- tosh 7y agoLove the lightning talk, thanks for the pointer.
- linsomniac 7y agoI also remember it because my thought was "That's amazing!" but also "That's such a toy, nothing useful could come of that". Which is also what I thought about PyPy. Both of which seem to have proven me wrong.
- parentheses 7y agoHe (author of Hy) is quite entertaining.
- TazeTSchnitzel 7y agoIt seems like it is pretty much just Python, but written with s-expressions and supporting macros.
- ErotemeObelus 7y agoAs if we need anything more.
- cutler 7y agoI don't agree with the "just Python". Hy gets around Python's crippled lambdas and frees you from indentation hell. Hy also gives you real macros, expressions instead of return statements, improved lisp-style comprehensions, :symbols and switch/case whilst removing the need for nonlocal/global.
- lonelappde 7y agoThe word "just" almost always adds nothing of value makes a sentence less polite.
- TazeTSchnitzel 7y agoI completely agree and try to limit my usage of it. I am using it here to emphasise that it is only a different syntax for Python and nothing more. That is not to say that it is not valuable or interesting.
- mepian 7y agoThe macros support is a pretty big deal.
- deleted 7y ago[deleted]
- mhxion 7y agoCloudflare throws a dns origin error. Repo: https://github.com/hylang/hy/blob/master/README.md https://github.com/hylang/hy/blob/master/README.md
- cutler 7y agoIf Hy could resolve its problems with let being moved to contrib and attracted enough manpower to reach 1.0 I think it could attract significant mindshare. Hy fills in the missing piece for devs who want to go all-in with modern Lisp supported by an established ecosystem, ie. front-end/Clojurescript/NPM, scripting/Hy/PyPi and back-end/Clojure/JVM.
- mark_l_watson 7y agoI agree that removing ‘let’ makes the language much less pleasing for me to use. I recently looked in contrib for ‘let’ and saw the macro definitions but could not get it working. It seems like a small thing, but it does keep me from doing more than rare experiments with Hy.
- rcarmo 7y agoDitto. I moved away from it partially due to the removal of let and partially due to lack of Python 3/async support (which is now landing). I’d really like to see a 1.0 with let back in the core, but I don’t see that happening just yet. Edit: typos, plus I’m also curious to see what https://github.com/gilch/hissp https://github.com/gilch/hissp will do.
- nerdponx 7y agoCurious what problems you had with let. I tried it recently and it worked fine. Having an import is annoying but it's not the end of the world.
- rcarmo 7y agoIt was removed without the replacement macro being fully baked, and a number of other things were changed at the same time. Rather than rewrite my stuff at every minor release, I moved on.
- nerdponx 7y agoThat's what I'm asking. What's not fully baked about it? In my (admittedly small) testing, it does its job of assigning stuff in a temporary scope.
- _def 7y agoCuddles the cuttlefish <3
- baalimago 7y agoW-Hy?
- bhougland 7y agoThe Jupiter notebook kernel seems to be broken for it right now.
- gilch 7y agoWhich one is broken? There were at least two, last I checked: * https://github.com/bollwyvl/hy_kernel/ https://github.com/bollwyvl/hy_kernel/ * https://github.com/Calysto/calysto_hy https://github.com/Calysto/calysto_hy
- foobar_ 7y agoLisp with the most amount of libraries.
- fhennig 7y agoThis is not like the clojure is to java, it's only a syntax transformation, superficial. Usually lisp and FP means that you get immutable data structures and a good concurrency system, both of which you get in clojure. I looked at this a while ago and figured it's not useful for production, but an interesting project none the less.
- JasonFruit 7y agoOr rather, it isn't useful in production in any way Python is not, and there's little reason to choose a weird stunted Lisp that offers few advantages over its host, an established language with a huge community.
- Zak 7y agoSyntax transformation via macros can be a significant advantage when the semantics of the language don't support an abstraction that's shaped like your problem.
- cat199 7y agototally agree with this. I can see even in larger python codebases some places where e.g. support for some s-exp minilanguage could be useful and implemented rather trivially via Hy, or also to embed some processing kernel which is well suited to being written in lispy semantics (e.g. symbolic programming, etc). Another use could be to define core primitives in python and glue them together using a heirarchy of configuration+Hy macros to generate specialized '__main__' programs for task-specific use cases.
- JasonFruit 7y agoThat is true; Hy has macros and Python doesn't. Thus "few advantages".
- yosefk 7y agoFP certainly means that you get immutable data structures (and that you don't get or at least don't use mutable data structures, by the definition of FP); Lisp - I dunno, CL has setf (and singly linked lists made of cons cells which can share a tail where you can modify the shared tail when working with of one of the lists and the other will get modified as well). As to a "good" concurrency system, that's a bit harder to define.
- mhd 7y agoOne problem I had with Hy is that some codebases really depend a lot on annotations, which gets a bit messier in Lisp syntax.
- mistersys 7y agoIt's a lisp, so you can build your own syntax, the messiness of annotatations is only limited by your creativity. (defna add [a :: int b :: int] (+ a b)) https://pastebin.com/5kpTBiz2 https://pastebin.com/5kpTBiz2 You could expand that macro to support decorators as well via extra arguments before the args list, you'd be in great shape.
- mruts 7y agoDoes the language support macros? If not, it’s totally worthless. Python is a pretty bad language for even casual FP, and a S-exp syntax layer isn’t going to help.
- tmountain 7y ago_ If not, it’s totally worthless._ Kind of a harsh assessment don't you think? Maybe some people enjoy working in Lisp-like languages while also enjoying Python's huge ecosystem of libraries. I doubt it's worthless for those folks.
- mruts 7y agoNo one actually likes the parens of Lisp. I mean, just look at Racket2. Even the dedicated lispers who work on Racket think they suck. I’ve written both Racket and Common Lisp professionally and consider myself very competent in both. In fact, I think they’re both great languages and one of the best around. It’s not because of the parens though, it’s because what the parens give you: namely homoiconicity and easy macros. Without these things, the increased syntax burden of parens don’t buy you anything except visual noise and being forced to type extra characters.
- kazinator 7y agoYour statement doesn't represent everyone. I thought that the design of Lisp was a great idea before I learned about its macros. (This was at a time twenty years ago when macros weren't being hyped in programming forums.) I was impressed that it simplified the specification of the language and the implementation of parsing, as well that it eliminated ambiguity. Then came the realization that formatting the code to look consistently good, no matter which way it is broken into multiple lines is trivial, and that it enables great editor support. Oh, and being able to just quote any chunk of the program as a datum! Also: Symbols tokens made up of almost any sequence of non-whitespace characters: if you type <->, that is a symbol without having to modify the lexical analyzer of the language to recognize a new token pattern. Basic math operations being variadic:(+ term0 term1 term2 ...). Here is an advantage of Lisp syntax: -123 is an actual negative integer token, and not the unary operator applied to 123, requiring evaluation.
- rmbeard 7y agoDNS error for me as well.
- Reason077 7y agoThe disturbing logo really puts me off wanting to learn more about this language.
- ComputerGuru 7y agoAm I missing something? It seems it's just a "cute" octopus.
- billfruit 7y agoI tried it out some time ago, but my view is that is too similar to clojure but also different in significant ways, making it a pain to remember the differences if you also happened to be working on clojure code. Being too similar but not the same can cause problems with programming language syntax.
- qwsxyh 7y agoI genuinely fail to understand the advantages of any sort of Lisp. Contrary to what gigantic brain lisp devs might think, it's syntactical annoyingness is far too much of a barrier to overcome.
- BeetleB 7y ago>it's syntactical annoyingness is far too much of a barrier to overcome. You're likely being downvoted because statements like these are more a reflection of you than the language, but instead of phrasing it that way, you come across as making an absolute statement about the language. In any case, I'll bit. I'm not a Lisp programmer - the extent to which I do Lisp is the occasional Emacs Lisp. Still: You can use virtually any character as part of your variable name. Lispers tend to use hyphen and '?' a lot. Once you get used to it, it's hard not to view all other languages as inferior. Why did they restrict the variable names so much? A lot more substantive: I saw this in John Kitchn's blog post somewhere. My details are probably a bit off, but I think I have the general gist of it. His team works on, I believe, computational chemistry. Their code base is in Python, and they've developed an API for various aspects of their calculation. A lot of their functions require a lot of arguments - not generally a good idea, but it makes sense in the domain they work in. To manage that headache, they've built a systematic way of documenting all those arguments in their docstring, with a particular format. Unfortunately, that means anyone in his team who creates such a function needs to conform to that format, and people get lazy, make mistakes, etc. So using Hy, he wrote a macro for another syntax for defining a function. With this new way of defining a function, there was special syntax for all the special information that needs to be in the docstring. The macro then creates the Python function with the appropriately written docstring. If the programmer makes a mistake, the macro fails. So now everyone uses the macro to create those types of functions. I don't recall the details, but let's say it was something like: deff func(x, x_doc="doc for x", y, y_doc="doc for y",...) If someone makes an argument called x, but does not provide x_doc, then it will fail. (I think in reality it was more than that - not just x_doc but x_doc_a, x_doc_b, etc and it generated the docstring from all those pieces). Now are there other, perhaps Pythonic ways to do this? Probably. However, it is nice that for a domain specific problem, you can just invent new syntax and use it.
- hodder 7y agoWHy? Super cool project, but what would be the purpose of it? Or is it just a fun project to develop skill?
- vaer-k 7y agoLisps are pretty pleasant to write in, and having metaprogramming support in your language is a game changer.
- AdamSC1 7y agoAnyone got an ELI5 on the goal of this language, or the pros and cons? I'm not a dev, but, a Python user with a background in data/info science - so I'm a bit unclear on what Wikipedia means by things like "a dialect language of Lisp", and using it to write "domain specific languages." Is this just a way to use Python libraries in Lisp (which seems to be a low level programming language?)
- pixelmonkey 7y agoDo you love Common Lisp, Racket, Scheme, and/or Clojure, but wish you had a language like that, but with full interop support for Python libraries (in much the same way Clojure has full interop for Java libraries)? If so, you might like Hy. It's not as mature as those other projects, but its support for Python interop is impressive, and by letting you write Lisp-style code, you can make more functional-feeling code and also do things like macros and metaprogramming more easily.
- jnbiche 7y agoLisp is not typically a low-level programming language, but rather extremely high-level (high level of abstraction)[0]. The "dialect language of Lisp" quote just means that it's a variation of Lisp, but running in a Python environment. The term "domain-specific languages" refers to programming languages created for a specific, often one-of, task. If you look at this repo, you'll see various languages used to create diagrams and graphs in this library. These are all examples of DSLs (note, they're in many places, this is just an example): https://github.com/francoislaberge/diagrams https://github.com/francoislaberge/diagrams Regarding Hy specifically, it's basically Python that uses a different syntax, or skin, of sorts. Instead of white-spaces and colons, you get parentheses and...parentheses. It's more complex than that, but it's basically just a way to write Python for people that like Lisps. 0. Yes, there are some examples of low-level lisps without features like memory management, but they're pretty unusual.
- alexanderdmitri 7y agoHow does Hy manage recursion given the limitations there in Python?
- tosh 7y agorelated: a story on Hy popped up on hacker news a few days ago [0][1] but didn't get much attention at the time: """ BETTER IS BETTER THAN WORSE: TALES OF A WEEK WITH HY AND A CALL FOR REVOLUTION by "Mr. Mojo Rising" """ I put it into nextjournal for easier reading: https://nextjournal.com/tosh/better-is-better-than-worse https://nextjournal.com/tosh/better-is-better-than-worse -- [0] https://0bin.net/paste/xmJWIlIv+Ws+Fbjs#zCyc4Yc4T+YISv3MHwMTwScu0as4xzqjns9YKaw1v1k https://0bin.net/paste/xmJWIlIv+Ws+Fbjs#zCyc4Yc4T+YISv3MHwMT... [1] https://hn.algolia.com/?query=hy%200bin.net&sort=byPopularity&prefix&page=0&dateRange=all&type=story https://hn.algolia.com/?query=hy%200bin.net&sort=byPopularit...
- StavrosK 7y agoHuh, I love this guy's writing style, thanks for the link.
- vzaliva 7y agoLet's combine things the many people hate: lisp parenthesis with python's GIL. :)
- dang 7y agoMany previous threads; some of the larger ones: 2017 https://news.ycombinator.com/item?id=14909786 https://news.ycombinator.com/item?id=14909786 2014 https://news.ycombinator.com/item?id=8696975 https://news.ycombinator.com/item?id=8696975 2014 https://news.ycombinator.com/item?id=7214400 https://news.ycombinator.com/item?id=7214400 2013 https://news.ycombinator.com/item?id=6700103 https://news.ycombinator.com/item?id=6700103 2013 https://news.ycombinator.com/item?id=5924709 https://news.ycombinator.com/item?id=5924709
- amirouche 7y agoDoes it support syntax-rules or something similar?
- gilch 7y agoIt has defmacro.
- karmakaze 7y agoTI(also)L: Kawa [Polish for coffee] is a language framework written in the programming language Java that implements the programming language Scheme, a dialect of Lisp, and can be used to implement other languages to run on the Java virtual machine (JVM). It is a part of the GNU Project. https://en.wikipedia.org/wiki/Kawa_(Scheme_implementation) https://en.wikipedia.org/wiki/Kawa_(Scheme_implementation)
- cercatrova 7y agoInteresting. Why not use Clojure which runs on the JVM?
- karmakaze 7y agoI've used both Clojure and Scheme (lazy racket) and find them both interesting. The part about Kawa that's novel is that it can be used to make other languages that run on the JVM.
- vincent-toups 7y agoI'm a long time Lisper and Hy makes Python just tolerable enough to use as a data scientist. It can't or doesn't want to solve Python's worst problems, but its a big improvement.
- ausbah 7y agoWhat are Pythons biggest issues from your perspective?
- vincent-toups 7y agoScope and type weirdness and just general lackadaisical design philosophy. Hostility towards functional programming. Its also still really really slow, particularly in this era of JIT languages like Lua. Also, I generally find the libraries to be amateurishly designed. Big one that comes to mind is Pandas.
- vindarel 7y agoHy made me reconsider Lisps and I'm glad it did. I'm now using CL quite a lot. It's possible to use Python libraries from CL: - there is py4cl and async-process: https://github.com/CodyReichert/awesome-cl#python https://github.com/CodyReichert/awesome-cl#python - NumCL is a clone of Numpy: https://github.com/numcl/numcl https://github.com/numcl/numcl Common Lisp has many advantages though: - you can build a self-contained binary of your app, including web app. It's such a breeze to deploy, and it's possible to ship a binary to users. - the REPL is much better and more fun than ipython - CL is compiled. We compile our code function by function, and we get many compiler warnings at compile time. - CL is stable, the syntax is simple, you can add the syntax you want with extensions (decorators, string interpolation,…) and yet, the implementations keep improving, and new ones are created (Claps, CL on LLVM). - CL is fast (how pgloader got rewritten from Python to CL: https://tapoueh.org/blog/2014/05/why-is-pgloader-so-much-faster/ https://tapoueh.org/blog/2014/05/why-is-pgloader-so-much-fas...) - there may be more libraries than you think: https://github.com/CodyReichert/awesome-cl https://github.com/CodyReichert/awesome-cl - the object system is very nice, the multiple dispatch makes me have a cleaner and shorter ABI of my app. - there are more editors with good support than Emacs: Atom support is getting very good, and there's more: https://lispcookbook.github.io/cl-cookbook/editor-support.html https://lispcookbook.github.io/cl-cookbook/editor-support.ht... - the (default) package management system works with "distributions", à la apt/Debian, so it doesn't break suddenly because of a third party of a third party dependency. Of course, the web stack is less mature (but more promising: see Weblocks http://40ants.com/weblocks/ http://40ants.com/weblocks/) and CL might be more difficult. It's not for every one. But it's been a joy so far.
- vippy 7y agoHy is AWESOME.