6 ms·
ClojureRS – Clojure interpreter implemented in Rust
- 0atman 5y agoMy two favourite languages made a baby! Would love to see this implemented as a macro too, like macro_lisp!
- Hammershaft 5y agoFrom the github: Project Goals: 1: To create a version of Clojure that gets to exist independent of a particular platform 2: To explore a Clojure that, being more independent, has Proper tail call elimination Conditions / Restarts Any other feature it might not normally be able to indulge 3: To, should the project progress, begin looking more serious into advanced compilation techniques, to create a serious Clojure implementation --- This is exciting stuff!
- goranmoomin 5y ago(While it seems that the project isn’t active) I’m interested not because of the Rust part but because of the more independent part, with plans to implement conditions and restarts [0]. I’ve mentioned a few days ago [1] about the lack of a clean and consistent lisp (in the development sense, not in the core-language-is-tiny sense) with a CL-like REPL-driven development workflow: maybe Clojure with conditions and restarts can be part of the picture? (In Common Lisp, restarts and conditions are a major part of the REPL as it allows the REPL to have a mechanism to catch error conditions and allows the user to resume execution appropriately, after the user debugs and fixes errors.) [0]: https://lisper.in/restarts https://lisper.in/restarts [1]: https://news.ycombinator.com/item?id=31179701 https://news.ycombinator.com/item?id=31179701
- capableweb 5y ago> I’ve mentioned a few days ago [1] about the lack of a clean and consistent lisp (in the development sense, not in the core-language-is-tiny sense) with a CL-like REPL-driven development workflow: maybe Clojure with conditions and restarts can be part of the picture? There seems to be some efforts of adding user-land conditions, see for example https://nextjournal.com/pangloss/a-tutorial-on-conditions-and-restarts-in-clojure?version=latest https://nextjournal.com/pangloss/a-tutorial-on-conditions-an... One could imagine another user-land REPL that also makes use of that, to give a similar REPL for Clojure as for Common Lisp.
- tko38 5y agoOh hey, yea this is mine. Stopped for a while initially because of serious epilepsy. Don't know when I'll pick it back up but in my free time I've been trying to think of what direction I want to take with it, because another goal not listed there (I think) is a Smalltalk-like development environment, but I almost wonder if I should just make that in vanilla Clojure. I do have a branch locally starting the implementation built upon some Rust graphics lib (iced or druid maybe)
- capableweb 5y agoNice to see you here, thanks for stopping by :) Really sad to hear about the epilepsy, hope it's going better now! Regarding picking it back up, would you have any interest in being funded by the community to work on the project? I know myself and others are very interested in seeing Clojure in Rust with interop, and would be interested in funding the effort if it's something you're interested in. Maybe you could leave some contact details on your about page here on HN (no one except HN mods/admins can see your email) and we could talk privately if you prefer that.
- tko38 5y agoNot sure, would have to discuss and think about it. I just put my email on my about page if that helps
- joshlemer 5y agoThanks for sharing! I think these restarts could definitely be implemented as a library in Clojure with the help of a coroutine library like https://github.com/leonoel/cloroutine#guides https://github.com/leonoel/cloroutine#guides
- didibus 5y agoSomeone added conditions/restarts to Clojure: https://github.com/IGJoshua/farolero https://github.com/IGJoshua/farolero It does allow errors to be caught by the Repl and choose how to handle them. Honestly though, I haven't found the interactive restarts at the REPL useful. It's way faster to just re-evaluate the code again. Maybe in CL they are more useful because the language is full of mutation? I can't say, I've only ever done Clojure and Emacs Lisp, but in Clojure I tried that library, and found picking options at the REPL to handle the condition was more laborious than just fixing whatever or adding a catch and pressing Ctrl+Enter again.
- fulafel 5y agoFor a more active native code Clojure interpreter with active users and practical libs, see also Babashka: https://github.com/babashka/babashka https://github.com/babashka/babashka (links under Related projects heading can also be interesting)
- capableweb 5y agoBuilt with the lovely SCI library (https://github.com/babashka/sci https://github.com/babashka/sci) + GraalVM, probably the most useful GraalVM project I've seen in the wild so far. Also, Babashka will probably always support more features than ClojureRS ever could, particularly the interop with the various Java classes/functions, as that'd be very hard to achieve in ClojureRS.
- hiepph 5y agoExtremely useful. I use it to write small to medium scripts, replacing Bash. For example, I wrote a small client that interacts with Pocket API. [1] Aside from interop with shell commands (I use Fish for that), most things seem pleasant so far. [1] https://github.com/hiepph/dotfiles/blob/master/scripts/_pocket https://github.com/hiepph/dotfiles/blob/master/scripts/_pock...
- geokon 5y agoI'm surprised people have managed to port Clojure to so many platforms. Seems like a ton of work! :) From what I understand the vanilla JVM implementation isn't built around a small core. So it's not like porting a Scheme. All the data structures and what-not are written with Java (not a criticism, it's great for performance and interop) But wouldn't it make more sense to first rewrite Clojure itself in some small/minimal scheme-y subset of Clojure - and then port that subset to Rust/Dart whatever? (With some performance penalty) I'm not super on top or Clojure's implementation, and people are prolly not doing this for a good reason - so I'm likely off base here somewhere
- tko38 5y ago> But wouldn't it make more sense to first rewrite Clojure itself in some small/minimal scheme-y subset of Clojure - and then port that subset to Rust/Dart whatever? (With some performance penalty) Actually indeed I think this is a possible route I went or have a note to try somewhere. The idea being if we can make a very lean Clojure core, and then the std library built upon that instead, it should be easier to port to other systems and share code. Gets tricky of course once you deal with code that relies at all on any sort of interop somewhere, but I should probably not get too much into it as my heads not been in that space for a while haha. The idea of a unified, universal Clojure of some sort (whether possible and practical or not) is an interesting problem in all this
- giraffe_lady 5y agoI wonder how many partial implementations of clojure are out there targeting different runtimes. I recently ran into the fennel cljlib which is not quite the same idea but definitely close. Not that any of these are the individually the wrong choice at all. It does suggest a lot of duplicated work, but I also get the sense that each's goals are different enough they maybe don't have as much overlap as it's easy to assume.
- roenxi 5y agoClojure isn't pitched to be a toy language. The sell is that it is making a great many really thoughtful design choices that add up to a pleasant language. The reason Clojure Classic is hosted on the JVM is because Rich wanted access to the Java ecosystem (and probably because the JVM is an awesome piece of tech). If ClojureRS follows the same mentality, the point here is someone wants to program in Clojure but have access to the Rust ecosystem. From this perspective it is clear why they'd avoid taking a small-subset approach with a possible performance hit. This isn't a tour of force showing how great Clojure is & how clever someone is that they can implement it on Rust. The idea is to get work done, using Clojure, which may need access to Rust's libraries. It doesn't need to be elegant, that isn't especially important.
- newskfm 5y ago[flagged]
- ReactNative22 5y agoNow can someone do the same for Common Lisp :D That would be amazing
- ducktective 5y agoI've been checking out Babashka [1] recently. It allows you to write clojure scripts and output a single-binary with fast startup time. Then I did a very brief search for clojure libraries, things like parsing html. Most of the github projects were not seeing much activity (like last commit in 2020). I've found bash-as-glue of unix programs like ImageMagick, curl, jq and pup very practical [2]. I was just looking for a possible alternative to be sure I'm not missing out. Doesn't seem like it. Anyone wants to hop in and sell me on his own approach? [1]: https://babashka.org/ https://babashka.org/ [2]: https://news.ycombinator.com/item?id=31142635 https://news.ycombinator.com/item?id=31142635
- jonahbenton 5y agoOne data point, from a registered bashochist, and a clojurist- I think he's on to something for Clojure-based build tooling. bb is much more ergonomic than the tooling Cognitect is themselves providing. But I don't see it getting into my main non-clj shell workflow. That's even though I really don't like having to appease jq's opinions of aggregate hierarchical querying. But there's too much unique value working directly in the shell in most cases. Where the shell work dips directly into areas clj is strong- pure data processing- I have recently been thinking that maybe bb could make it easy to create a full clj repl environment, so I wouldn't have to suffer through jq. But that wouldn't be doing the work in a shell with bb. It would be doing the work in a repl. FWIW. One other point- lack of activity on clojure libs is not the red flag it is in other languages. There's much, much less of the churn and grind that there is everywhere else in the ecosystem. When there is something novel that doesn't have a native clj implementation, it very likely will in Java, and pulling that into clj- even straight from java source on github- is easy. HTH. Cheers.
- ducktective 5y agoYou see, I keep asking myself, when I want image processing, I reach for IM. video processing? ffmpeg. Json/XML/any structured data? jc | jq. It's hard to beat this workflow. Like, what possible ""java"" library is gonna beat the ubiquitous unix tools?
- jiyinyiyong 5y agoI made myself a scripting language called Calcit http://calcit-lang.org/ http://calcit-lang.org/ , features persistent data function, macros, higher-order functions, and also compiles to JavaScript. Now I use it as a replacement for ClojureScript since I make Calcit compile to JavaScript in ES6 module, which works seamlessly with Vite! If anyone feel interested, please give a try. One thing to notice is Calcit is using indentation-based syntax while supporting macros. It's strange, but it works really well.
- fuzzythinker 5y agoWow, you have so much cool tools you are building. It's been .5 hrs since I started digging and is still reading up on https://github.com/Cirru https://github.com/Cirru, calcit-editor, and your medium posts. You should post sometimes on https://www.reddit.com/r/nosyntax/ https://www.reddit.com/r/nosyntax/ if you haven't already. Edit: On to your year in review posts now. https://jiyinyiyong.medium.com/year-review-of-2019-on-coding-and-moods-4f4125102e62 https://jiyinyiyong.medium.com/year-review-of-2019-on-coding... https://jiyinyiyong.medium.com/wip-2020-working-projects-38dc6155d6b5 https://jiyinyiyong.medium.com/wip-2020-working-projects-38d... Seeing Cirru being used is a good sign. Showing a tiny graph of usage over time can give confidence to new users.
- jiyinyiyong 5y agogood idea. I will post Cirru there. I have several more articles/videos posted in Chinese, not ready to push all that forward yet... there are too many repos under Cirru and Calcit, many of them are not well maintained I'm afraid. :D