4 ms·
Ask HN: Anarki or Racket?
For a new web-baed project, one I'm doing for fun but hope to make a success, I've pretty much decided to write it in Racket or Anarki.
Which one?
The problem domain is Lisp-y: convenient for functional programming, and made easier with macros, DSLs and/or metaprogramming.
I haven't used a proper Lisp since my programming paradigms course at Bryn Mawr many moons ago, so I don't have any strong preferences yet.
Obviously either will do the job, and Anarki is built on top of Racket.
Still, what are the pros and cons (pun intended) of each?
- hawkeyedan 4y agoJust to be clear: yes, there are other Lisps. Yes, Clojure is cool. Yes, LFE is a thing that exists. Yes Elixir is Lisp-adjacent. Yes, any of those would give me access to a larger ecosystem and the resources of a well used, well supported VM. I may be an idiot (it's been said), but I'm not a stupid idiot. I've ruled each of those out for good-ish reasons.
- _448 4y ago> I've ruled each of those out for good-ish reasons. And what would those reasons be?
- hawkeyedan 4y agoLFE lacks it’s own robust web app development stack … and translating between documentation in Elixir (Phoenix) and Lisp all day will make my head hurt. Clojure is a tougher call. For this project it might be good. However, I want to include some CLI scripts … and the JVM adds deployment complexity for those. ClojureScript is tempting, but I don’t see a great story about the server piece for rapid web app development there.
- fulafel 4y agoDo you want scripts as in "i want text files run by an interpreter" or "i can package my scripts as single executables"? In Clojure land Babashka and Graal native image can do those respectively.
- hawkeyedan 4y agoText run by an interpreter. Different strokes.
- mepian 4y agoAny reason why Common Lisp is not considered?
- hawkeyedan 4y agoIt’s not in my mix because it’s a fairly “big” language, which is a huge bonus once you’re proficient but makes it a poor choice for me to dive into Lisp(s). For someone else, that might not be true. But I like to be able to hold things in my head. In the long run, CL is a great option. My theory is that it’s a place I could go if/when I’m up and running in another Lisp.
- feeley 4y agoI'm not sure what part of your project is web-based and what you mean by "web-based". Do you mean executing Lisp/Scheme code on the browser side or the server side? In any case you should consider Gambit Scheme that has a complete JavaScript backend. For example check out the https://try.gambitscheme.org https://try.gambitscheme.org site to see the online REPL in action.
- hawkeyedan 4y agoIn my case, web-based just means "it is a piece of software you access via the web." Web application, website, SAAS, whatever. And you're right, I should have considered Gambit. Dang, now I have a ternary decision to make.
- feeley 4y agoThe FFI with JavaScript is nice. Have a look at this paper, in particular the examples that can be copy-pasted to https://try.gambitscheme.org https://try.gambitscheme.org: https://www-labs.iro.umontreal.ca/~feeley/papers/BelangerFeeleyELS21.pdf https://www-labs.iro.umontreal.ca/~feeley/papers/BelangerFee...
- hawkeyedan 4y agoWhile I’ve got you… What’s the state-of-the-art story for package management in Gambit?
- feeley 4y agoGambit supports the R7RS module system and has a decentralized module system that can automatically download libraries from git repositories. Take a look at the "Libraries" section of the online REPL's tutorial for a few examples, or just type at the REPL: > (module-whitelist-add! '(github.com/feeley)) > (import (github.com/feeley/roman demo)) This paper might be helpful if you want to know why it was designed that way: https://www.iro.umontreal.ca/~feeley/papers/HamelFeeleyELS20.pdf https://www.iro.umontreal.ca/~feeley/papers/HamelFeeleyELS20...
- krapp 4y agoAs someone who's used Anarki, and contributed to it (for better or worse,) between the two I'd have to recommend just using Racket. All of the web stuff in Anarki just calls Racket libraries sooner or later, and Racket has better facilities for HTML and other language generation. Anarki (IMHO) is really only good if you want a HN clone without changing much, or if you want to experiment, because it's still rough around the edges in places, documentation is spotty, and error handling is still a disaster.
- hawkeyedan 4y agoThanks, that’s a very helpful insight. You’ve put my mind a significant ease.
- idoh 4y agoI've tried both. While I enjoyed the setup with Anarki better (in particular using the repl to make live inspections and changes), Racket is vastly more supported by docs and the community. So if you are a CS pro and don't mind figuring out everything for yourself then Anarki is plausible, otherwise it's kinda crazy to go that way.
- soegaard 4y agoFWIW the source of both racket-stories.com as well as mini versions are available. https://racket-stories.com/about If you are looking for a framework, then check out Koyo.