
How to Use Clojure for Scripting - asimjalis
http://asimjalis.github.io/blog/2016/12/07/clojure-for-scripting.html
======
abeyer
"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
If 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
Here's a wonderful talk to introduce its design and value
[https://www.youtube.com/watch?v=1AjhFZVfB9c](https://www.youtube.com/watch?v=1AjhFZVfB9c)

------
sooheon
If 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-t...](https://anmonteiro.com/2016/11/the-fastest-clojure-repl-in-the-
world/)

~~~
krat0sprakhar
Seconded. 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)

~~~
Scarbutt
I 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
So that it would have iOS support via JSCore.

------
dm3
You 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
Nice. I like it. Thanks!

------
Jach
Only 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...

------
jiyinyiyong
Boot 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)

------
ethagnawl
I 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.

------
nebosite
I love it. Simple and easy to get started.

------
funnyclj
how do you start a boot repl in production?

