6 ms·
How to Use Clojure for Scripting
- sooheon 10y agoIf you want to keep the repl running this is fine, but for scripts, you should be using planck[1] or lumo[2]. Planck in my experience has nice command-line args parsing by default, both should be fast enough not to be annoying when running scripts. [1] http://planck-repl.org http://planck-repl.org [2] https://anmonteiro.com/2016/11/the-fastest-clojure-repl-in-the-world/ https://anmonteiro.com/2016/11/the-fastest-clojure-repl-in-t...
- krat0sprakhar 10y agoSeconded. Planck is fantastic for scripting, and the accompanying tutorial[0] is great for getting started. The only problem is that its OSX only [0] - http://planck-repl.org/scripts.html http://planck-repl.org/scripts.html
- weavejester 10y agoThe Planck 2.0 beta has Linux support, I believe.
- cossovich 10y agoYep, now with Linux support. There's a wiki page[1] that has details on building for different distros. Works a treat on my Ubuntu 16.04 desktop. [1] https://github.com/mfikes/planck/wiki/Building https://github.com/mfikes/planck/wiki/Building
- Scarbutt 10y agoI don't get it, why didn't he used nodejs from the start instead of JSCore so it would have windows,linux,osx support?
- notduncansmith 10y agoSo that it would have iOS support via JSCore.
- dm3 10y agoYou don't need that `cemerick.pomegranate` import. Boot can already do that - the `deps` functions should look like this: (defn deps [the-deps] (merge-env! :dependencies the-deps))
- asimjalis 10y agoNice. I like it. Thanks!
- nebosite 10y agoI love it. Simple and easy to get started.
- Jach 10y agoOnly sort of related, does anyone have any insight into whether Slamhound will eventually support ClojureScript? Namespace declarations were probably my least favorite part about Clojure until I happened on Slamhound, now I pretty much don't have to think about them. Working with ClojureScript without Slamhound is rather annoying...
- ethagnawl 10y agoI thought Boot's scripting features were removed in the 2.0 release? If I remember correctly, there was a major overhaul in both its API and feature set. I'll have to revisit the changelog/docs. Anyways, running a clj file using the provided shebang does indeed work! Albeit _much_ more slowly than a comparable Perl|Python|Ruby script.
- abeyer 10y ago"This turns Clojure into a scripting language much like Python, Ruby, Perl, or Bash" would be if you added a sleep(45) to the beginning of every script you wrote with them. All the latency of a compiled language with all the bugs of dynamic one. :) I'm (mostly) kidding... I want to like clojure. I've always had a soft spot in my heart for lisp, and clojure seems to be the best contender for hitting the right balance between the classic "no syntax at all, just more parens" and various more modern takes on "It's lisp, but with our own weird syntax bits layered on." Unfortunately the JVM'ness of it has shown through so much as to kind of turn me off. (Not least of all the overhead of starting a JVM to do anything.)
- Spiritus 10y agoIf you think Clojure has too much startup overhead for scripting, maybe Pixie[1] will pique your interest. [1] https://github.com/pixie-lang/pixie https://github.com/pixie-lang/pixie
- agumonkey 10y agoHere's a wonderful talk to introduce its design and value https://www.youtube.com/watch?v=1AjhFZVfB9c https://www.youtube.com/watch?v=1AjhFZVfB9c
- eroiusghs 10y agoIf I could simply `apt-get install pixi-lang` or `brew install pixi-lang` I'd be using it.
- abeyer 10y agoThanks, hadn't seen that, but am going to check it out.
- islon 10y agoIf the JVM or the startup time bother you you can try using ClojureScript with node.js.
- baldfat 10y ago> I want to like clojure. I've always had a soft spot in my heart for lisp Have you tried Racket?
- jiyinyiyong 10y agoBoot is too slow to start. Use Lumo, which is based on Node.js and boots really fast. And npm packages are available too. Well, it's more JavaScript than Java. https://github.com/anmonteiro/lumo https://github.com/anmonteiro/lumo
- funnyclj 10y agohow do you start a boot repl in production?