7 ms·
Fancy Clojure REPL
- finnjohnsen2 7y agodoes anyone actually use the REPL CLI, and not a client?
- iLemming 7y agoUseful 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.
- LandR 7y agoMy 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 7y agoYeah, it is the only one that somehow approaches the experience from commercial Common Lisp environments.
- lvh 7y agoNot 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 7y agoCan it also display graphical representations of data structures, notebook style like Lisp Machines and commercial Common Lisps?
- lvh 7y agoThat'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 7y agoThanks for the overview.
- robto 7y agoThe Datafy[0] protocol can be implemented for literally anything, and some people have made some pretty nice pretty printers for it, like Rebl[1] [0]https://clojure.github.io/clojure/clojure.datafy-api.html https://clojure.github.io/clojure/clojure.datafy-api.html [1]https://github.com/cognitect-labs/REBL-distro https://github.com/cognitect-labs/REBL-distro
- 7y ago
- LandR 7y agoOther good clojure add on for ideaj is rainbow brackets! And clojure pretty symbols.
- short_sells_poo 7y agoSlightly tangential: the Rainbow Brackets plugin is awesome and I use it in PyCharm too because it makes nested parens in math formulas a bit easier on the eye.
- giancarlostoro 7y agoI use it in every single IntelliJ IDE I use. It is highly underrated in my opinion. When I first saw it suggested I was immediately sure it would be useful. Somebody tried to argue that good spacing is the way to resolve any confusion with multiple parens, but I don't think so, visual colors are way better. Java devs love to put curly braces egyptian style, I prefer the C# approach personally, but with Rainbow braces I don't have to care.
- fctorial 7y ago> It will also do some autocomplete, although this seems flakey Can you explain this point. Is it possible that you might have forgotten to sync the new code with the repl. Editor and repl use different completion backends in cursive.
- wlkr 7y agoThis 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 7y agoDo you know if it's anywhere near competitive with CIDER?
- lvh 7y agoTL;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 :-)
- microcolonel 7y ago> 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 :-) I will definitely give you folks some money for that. Thank you for making it a thing! :- )
- lvh 7y agoThis 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 :)
- yters 7y agoI thought the name of the REPL was Asciinema.
- bdcravens 7y agoYeah, 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 - ")
- akavel 7y agoI 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.
- res0nat0r 7y agoLooks like rebel-readline https://github.com/bhauman/rebel-readline https://github.com/bhauman/rebel-readline
- snek 7y agoI 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
- fmakunbound 7y agoThis 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 7y agohttps://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 7y agoThat 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 7y agoWhat's painfully awkward about it? Can you list some specifics?
- iLemming 7y agoIt 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 7y agoWhat 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.
- finalfantasia 7y agoI think what @iLemming meant is that she/he doesn’t understand the appeal of having a fancy REPL _UI_ (mostly virtual terminal emulator-based readline implementations) and working with it _directly_ as opposed to sending forms from your editor of choice to a REPL server. I kind of hold the same opinion. Being more powerful, feature-rich, flexible than readline implementations, editors are, by design, more suited to editing forms. And, I believe, “sending forms from your editor to the REPL” is what the “REPL-driven development” encourages.
- capableweb 7y agoIlemming doesn't seem to care about the UI to the REPL. They simply don't care about REPLs at all. At least that's what I understand from: > I almost never type directly in the REPL, even when I have it in my IDE I agree that it's more comfortable to be able to send forms from your editor to be evaled somewhere else, I myself don't use the CLI REPL very much, but since I use vim-fireplace, I guess my REPL is in the terminal anyways. Since it wasn't clear in https://news.ycombinator.com/item?id=22193862 https://news.ycombinator.com/item?id=22193862 what language iLemming uses or have experience with REPLs, I just wanted them to clarify.
- mrbonner 7y agoI'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 7y agoIt would be lovely with a video demo of this!