
Fancy Clojure REPL - tosh
https://asciinema.org/a/296507
======
fmakunbound
This REPL like Nodejs REPL are great efforts, if limited to a teletypewriter
emulator.

They're pretty terrible compared to what was available in Lisp machines and
Smalltalk (for example) from decades ago and what now live on in McCLIM's Lisp
Listener [https://common-lisp.net/project/mcclim/excite.html](https://common-
lisp.net/project/mcclim/excite.html) and Pharo Smalltalk Playgrounds.

The main problem is the Print part results in "dead text". For example, you
can't re-select it (other than using history shortcuts), you can't interact
with it (it's dead, afterall) and there was only one representation of it
(some kind of "to-string" for it). You can't even inspect it.

Beyond that, you're stuck with the teletypewriter environment. You can't
display an image, or sound wave, statistical model graphically etc, let along
interact with them.

~~~
casion
[https://www.youtube.com/watch?v=c52QhiXsmyI](https://www.youtube.com/watch?v=c52QhiXsmyI)

[http://rebl.cognitect.com/download.html](http://rebl.cognitect.com/download.html)

~~~
fmakunbound
That is just a painfully awkward inspector. I don't know why Halloway isn't
aware of the prior art. I thought he had some experience with Common Lisp...

~~~
blain_the_train
What's painfully awkward about it? Can you list some specifics?

------
wlkr
This looks great, I'm looking forward to giving it a go! Since I've found
myself using VSCode pretty much full time now, my current workflow is to use
the Calva plug-in [0] which provides a nice REPL amongst many other awesome
features.

[0]:
[https://github.com/BetterThanTomorrow/calva](https://github.com/BetterThanTomorrow/calva)

~~~
microcolonel
Do you know if it's anywhere near competitive with CIDER?

~~~
lvh
TL;DR: absolutely yes it's competitive with CIDER; there may be experiments in
the CIDER ecosystem that you won't get with Calva but 99% of the stuff you
will actually use works totally fine in Calva and if you like VS Code you
should definitely not think twice about it :)

Caveat: I don't use Calva myself, but I'm the president of the Clojurists
Together Foundation. We just funded Calva's development and of course did some
due diligence in the process. It's definitely got a ton of features, it's
stable, but it's maybe slightly less feature-complete than the CIDER ecosystem
right now. Hopefully funding helps change that, I'm a happy Emacs + CIDER user
but rising tides lift all boats :-) One thing I love about Calva is that
there's less fiddling. You just turn it on and you get 99% of the actual
functionality of a top-end Emacs setup, except you didn't spend hours getting
it to actually work. (Spacemacs makes this a lot better, but not everyone uses
Spacemacs.)

While Calva isn't CIDER, it does build on stuff that is either directly from
CIDER or de facto from CIDER (e.g. nrepl), so fortunately there's a lot of
development effort that directly or indirectly helps both projects.

Finally, the shameless plug: if developing the Clojure ecosystem is important
to you you should consider giving us (Clojurists Together Foundation) money --
we've funded critical infrastructure like CIDER, fireplace, Ring, Reagent,
shadow-cljs... Oh, and we keep a little thing called Clojars afloat :-)

~~~
casion
This seems unfair towards CIDER. Cider has excellent debugging, stacktrace
navigation, integration with other tooling and more... that isn't available in
Calva.

I would never say that you can't use Calva to get work done, but CIDER has a
good deal more than what Calva offers currently.

I could accept that maybe "99% of users don't need what CIDER offers", but
saying that Calva is 99% of what CIDER offers is just completely incorrect.

~~~
lvh
... Good thing that I said "but 99% of the stuff you will actually use works
totally fine in Calva" which is a lot closer to your first example than the
second? Given that I explicitly acknowledge the feature gap?

------
mrbonner
I'll give this a try. I'm currently using VSCode & Calva. It's been a bless! I
create an uberjar with Clojure's nrepl server and start that server with my
java project's dependent jars. At the end, I am able to "jack-in" the embedded
repl server running with in a production-like environment. Needless to say,
when I demoed this stuff, many engineers were excited to learn more about
Clojure. They saw I inspected, ran and modified behavior of existing code all
in the REPL without even redeploy/restart anything.

I have to say that there are 3 things that I am very grateful for acquiring in
2019: got into Bach's music, learn to play the piano and finally "got" LISP
via Clojure.

~~~
cospaia
It would be lovely with a video demo of this!

------
lvh
This looks super cool! I'd love a pitch for when you use a terminal clj repl
versus your development environment. For years using Python I was constantly
experimenting in a terminal REPL, but now with CIDER (or other IDEs--I just
happen to use CIDER) it feels like the integration is so good I just do all my
REPL work as a side effect of using an editor.

For a long time I ran venantius/ultra but too many of the dependencies ended
up randomly breaking stuff. These deps look a little less likely to do that so
I'll give it a shot :)

------
LandR
My default Clojure REPL in IdeaJ with Cursive has colour coding, hints from
the docs etc. If I type

    
    
         (set/union a b)
    

it will auto add the set namespac, it has history etc. Supports paredit.

It will also do some autocomplete, although this seems flakey.

~~~
pjmlp
Yeah, it is the only one that somehow approaches the experience from
commercial Common Lisp environments.

~~~
lvh
Not trying to convince anyone, but if someone is already using Clojure with
Emacs (which the annual survey seems to suggest is the most common case):
those are all features you get with CIDER + clj-refactor as well. If you use
spacemacs, I think they mostly just work out of the box if you turn on the
Clojure layer (and maybe turn on clj-refactor -- I forget if that's an option
or a default now).

~~~
pjmlp
Can it also display graphical representations of data structures, notebook
style like Lisp Machines and commercial Common Lisps?

~~~
lvh
That's not one of the features GP enumerated, but, yes, there are lots of
flavors of accomplishing that while using CIDER.

The two most common ways I've seen people accomplish something like that is
probably Clojure's builtin inspector functionality and CIDER's general ability
to display any kind of image (which conveniently lets it do stuff like
plotting as well). If your focus is on the permanence and documentation aspect
of the notebook experience, you're probably going to be happier with ob-
clojure or Gorilla REPL. If your focus is on the exploratory part, you're
probably going to be happier with REBL, or if you really want everything
inside an emacs buffer you might do that with walmartlabs' datascope. I do
everything with cider-inspect because I don't find the graphical visualization
that valuable -- most of my data structures are too large so I ~always end up
writing a specter query ~immediately.

All of this is for Clojure specifically. If you're writing in-browser apps
you'll probably like frisk (through re-frisk or data-frisk), where you can do
this stuff right in your browser next to the app:

[http://odinodin.no/x/datafrisk/](http://odinodin.no/x/datafrisk/)

[https://github.com/flexsurfer/re-frisk](https://github.com/flexsurfer/re-
frisk)

\-- but that's not technically in CIDER, though you can certainly use it from
CIDER.

~~~
pjmlp
Thanks for the overview.

------
iLemming
It looks cool, but I never understand "obsession" with having nice [Lisp] REPL
in the terminal. I almost never type directly in the REPL, even when I have it
in my IDE. One of the selling points of Lisp that you can eval any expression
from your editor, isn't that right?

~~~
capableweb
What languages do you usually use? REPLs for languages like python and nodejs
are never as integrated and well working as REPLs for lisp languages like
Clojure. Probably the structure of the code that lisp almost forces you to
have, makes the REPL experience much easier. Especially in Clojure where most
functions are side-effect free which means you can run them out-of-context, as
long as you've defined the vars it's using since before.

~~~
iLemming
Because non-homoiconic languages don't have "true" REPLs. At best they have
"interactive environments". What's great about Lisp, and the point people
complaining about parentheses miss, is that you can eval any [sub]expression
without any preceding ceremony. That is not possible in almost any other
language (maybe with exception of Smalltalk), simply due to the nature of the
language syntax.

In Clojure, if you have something like:

(foo [a b] ((c a) b))

you can evaluate every single part of it, you'd get immediate feedback, what
is `a`, what is `b` and `c`, the result of `(c a)`, the result of the entire
thing, etc. Similar thing in JS would be something like:

let foo = (a, b) => { return c(a)(b); }

It's already more difficult to edit, there's no "structure", it's not easy to
evaluate arbitrary pieces without "dancing around", introducing temp
variables. Given Clojure code snippet is also data, it can be send over the
wire, send directly to the connected REPL instance, etc.

That's what gives Lisp developers a substantial speed of development. When
people talk about "what's good about Clojure", they usually say: immutable
data-structures, stability, hosted nature - can target JVM, JS, BEAM and CLR,
can even have interop with Python and R. But the coolest thing about Clojure
and Lisps in general - they provide "true" REPLs.

~~~
e12e
Smalltalk isn't homoiconic?

You can certainly eval parts of a python or ruby program (although
indentation-as-block needs some care in python).

In lisp you also need a useful scope (eg: if foo isn't bound "(foo 1 2)" won't
be very useful).

~~~
iLemming
No, Smalltalk is not fully homoiconic, it has some nice "reflective"
abilities, i.e. it's possible to view "code as data" that allows good REPL
experience. But it's not a homoiconic language.

------
snek
I love seeing what people are doing in the space of REPL interactivity. I've
been working on a similar project, but for Node.js[1]. One of the things I've
found the most helpful so far is color highlighting the _input_ , in addition
to the output.

[1]: [https://github.com/nodejs/repl](https://github.com/nodejs/repl)

------
res0nat0r
Looks like rebel-readline [https://github.com/bhauman/rebel-
readline](https://github.com/bhauman/rebel-readline)

------
akavel
I recommend also having a look at OCaml's utop, it's also a very advanced REPL
with at least some similar features, and taking advantage of OCaml's static
typing.

------
finnjohnsen2
does anyone actually use the REPL CLI, and not a client?

~~~
iLemming
Useful for newbies and for small experiments. Once you learn how to evaluate
s-expressions directly from an IDE connected to a REPL instance - you probably
would never directly type in the REPL again.

------
yters
I thought the name of the REPL was Asciinema.

~~~
bdcravens
Yeah, that's a bit unclear, though I think the intention is to preface the
format for those familiar with Asciinema (similar to "Video - " or "Slide Deck
- ")

