Fork me on GitHub

Thanks @borkdude. Nightcode used to be fabulous and I taught with it, but recent versions, rather than supporting re-indentation, force use of parinfer. I think that all of the others in the JAXenter list are misses too. Emacs+CIDER is complicated to install and learn; Atom/Proto-REPL requires Java + leiningen or boot; Cursive is heavy weight and I think also requires that you're set up for Clojure; Counterclockwise, aside from being Java/Clojure based as well, hasn't been actively maintained for several years. I'm looking for a text editor with Clojure/script re-indentation, that could be used for Clojurescript by newbies without having to install or configure very much (and ideally not Java/leiningen/Clojure).


@lspector I would suggest VS Code. has decent Clojure indentation and plugins (one called “Calva”)


if all you want to do is do some editing with indentation and syntax highlighting, it’s pretty easy to get started


Calva is there when you want to jump into connecting your editor to a REPL and start doing more advanced things


I’m a bit confused about your Java + leiningen comments tho. that sounds like project dependencies, not editor


Thanks @lilactown. I've been working with VS Code/Calva for Clojure work for bit now, but you need Java/Clojure/leiningen to get it to work. I'm now looking at the calva-fmt page though, and maybe one can indeed get re-indentation without installing the rest. I may need to find a machine without those other things installed to give it a try.


:thinking_face: I can’t imagine why you would need Java, Clojure or leiningen, unless your project needs it


it’s written in TypeScript/CLJS


PS also there's currently an issue that Calva won't re-indent forms that aren't properly balanced, which is a problem


I agree that one shouldn't need Java or leiningen for an editor! But a lot of the options assume you're writing/running Clojure and you do indeed need that stuff.


Nightcode is a notable exception, but it forces parinfer.


well if you’re using an option that requires connecting to nREPL to evaluate code, then yes you will need an nREPL server. usually in your build tool, and AFAIK all of the common CLJS build tools use Java


I write all of my CLJS projects using either VS Code or Emacs, and all they use are shadow-cljs, which is a Java program


unless you’re building your code using one of the self-hosted compilers like lumo, which IMO is more advanced, your students probably need to have at least Java and Node.js installed


My aim here is for a student with nothing related to programming on their computer initially, with as little installation as possible, to be able to follow the Quick Start instructions at with one enhancement: in place of "your favorite editor" use an editor that supports Clojurescript re-indentation (and, actually, bracket-matching).


Oh shoot! I'm only now realizing that those instructions require clj which means Java 😞


other than the bug that you encountered, I don’t see how VS Code wouldn’t fit that


I was hoping there was a Java-free path here for someone to write and run Clojurescript


and yeah, almost all of the tools use Java


you could try using one of the self-hosted compilers… but that relies on having a JS runtime like Node.js installed


and is probably more advanced than you want


Sigh. I've lost weeks at the beginnings of semesters getting Java/leiningen installed on student machines (usually it's Windows machines that are the biggest problem because I don't know Windows, but sometimes Macs have annoying problems with Java versions too). I was really hoping there was an on-ramp to Clojurescript programming that could bypass that.


leiningen I can see being a pain


I've had students who failed to get leiningen running for the whole semester, which meant they could only work on our lab machines, which was a big drag


yeah. I’ve struggled to get lein installed on coworkers machines using Windows


we ended up using a slightly modified lein.bat through Cygwin ?? I don’t know, it was probably wrong but mostly worked


I think Java is a necessity. Clojure/Script is heavily invested in Java, you can’t get away from it IMO


Makes sense for Clojure, but I thought we might be able to get around it for Clojurescript


well, you could try out one of the self-hosted compiler tools:


I guess for working in Clojurescript, following the Quick Start page, we only need clj and not leiningen at least, right?


if you want to bet on Node.js vs. Java


right. for your macOS/Linux-using students, they’ll be able to use clj


for your Windows-using students, they’ll be able to download and run the cljs.jar


huh... I'm not understanding all of this yet but I'm looking into lumo


the README for lumo might be a little out of date


it refers to some instructions: > Please reference its Quick Start and the Compiler Options. You can basically just replace the namespace with on the clojurescript site that doesn’t exist anymore


I was able to do the manual installation (the other options gave me lots of errors), and I can run it and get a cljs.user prompt. So that seems promising. But I don't yet see how to translate the stuff on the Clojurescript Quick Start page to use this.


In other news I've just installed VS Code + Calva Clojure Formatter on my wife's machine, which doesn't have Java installed, and it runs, and goes into Clojure mode with a .clj file... but doesn't actually re-indent 😞




formatting doesn’t work at all? that’s weird


Yeah, just stays unindented, and tab just adds spaces, regardless of the structure


oh wait -- did a re-load of the extension and now it works!


That's helpful. Still has Calva's problem of not working with unbalanced expressions, but this is getting somewhere: within Calva's constraints, VS Code + just the Calva formatter may be the simplest way to get some Clojure/script re-indenting behavior on a fresh/student machine.


If I could figure out or get simple instructions for doing what it says on the Clojurescript Quick Start page but with lumo instead of clj, then I might be in business for a beginner setup that doesn't require installing Java


yep. VS Code is also a good editor for a lot of other languages, so it’s worth students getting familiar with it. the learning curve is much less steep than something like Emacs or IntelliJ tho


I’m not sure that you’ll be able to get a browser-connected REPL with lumo


I don't think I need a browser-connected REPL for this. I'm just looking to have the code that the user writes in the editor run in the browser, like the example on the Quick Start page. Can lumo support that?


FWIW if I could get something that did re-indenting for unbalanced expressions and bracket matching, even if it wasn't any good for any other languages or anything else, and was at least as easy to install and run as VS Code, then I'd prefer it. But VS Code/Calva is easy enough and the functionality is at least a lot better than no re-indenting at all.


I would suggest creating a github issue about that in the calva-fmt repo. I know that they’ve been doing a lot of new development on that recently


I’m sure lumo can support something like that. but my guess is that going with the status quo (install java, run the jar) will be the easier path


I don't think lumo is going to support much of the cljworkflow that iirc the newer quickstart recommends.


@lspector is the course content mostly about algorithms? I think could be a great educational tool, with minimal setup requirements.


@john this would be for a couple of different kinds of courses. does indeed look cool, but my recollection from looking at it before is that it doesn't let you use libraries, build projects, etc.


None of the courses would be about webdev though. They'd be on things like AI, genetic programming, ALife, etc.


Lately I've been doing these in Clojure, mostly pure Clojure but sometimes with and often with AI/GP code/libraries that I provide.


Moving to Clojurescript is attractive so that students can (I hope) easily put their running projects in web pages, and I thought also maybe avoid the setup hassles that we often have. Some of those were about Java, but maybe more were about leiningen, so if we can get by with just Java that'd be a step in the right direction


yeah. I do all of my personal development with the CLI tools and shadow-cljs


if they want to do live programming/hot-reloading with CLJS, they’ll need to use a tool like figwheel or shadow-cljs


shadow-cljs is practically equivalent to the combination of figwheel + CLI tools


shadow-cljs is new to me... just checked it out and there's a lot that I don't understand, but since it requires Java too I guess I'll continue considering CLI tools as the approach


Can anyone recommend an http client library for use with node? I'm writing lambdas for AWS, and can't get kvlt or cljs-http working, as they seem to require npm dependencies, which I can't figure out how to do


full disclosure: i know very little about npm, i'm trying to learn as i go, so any help is greatly appreciated and will end up in a blog post to help others!


IMO no need to bother with cljs wrappers


They’re more trouble than they’re worth


oh that's interesting, thanks!


although ideally i'm trying to avoid using npm


You can include the node modules folder in the zip you send up to lambda


yeah, took me a long time to figure that out!


I wouldn’t try to avoid npm


can i ask a quick question - how do you know which npm dependencies you need to install for a cljs project?


Embrace the host


i've just had to go through all the errors one by one, but theres a very slow feedback loop when copying/zipping node_modules, uploading to AWS and running


you won't be able to avoid npm anyway


I don't understand the "npm dependencies" question


just add a package.json listing the requirements you need (e.g. node-fetch)


then use (def node-fetc (js/require "node-fetch")) and you're off to the races


what i mean is, how do i know what the npm dependencies of my cljs libraries are? the project i'm working on uses one library (kvlt) which has about 5 or 6 npm dependencies. but to find out what they are (so i can do an npm install on each), i have to package it all up and run it on AWS. it would be really useful to know when i add a library what its npm dependencies are


i think you must be misunderstanding something


the cljs libraries on cljsjs typically don't have any extra requirements - everything is contained in the jar


as a piece of advice i wouldn't play with non-standard cljs libraries (kvlt looks like it's unmaintained?) until you're more comfortable with the ecosystem


better to learn how the platform works (node, lambda) and how to interact with it using js interop - that allows you to do everything that a js programmer can do


cljs wrappers are at best the icing on the cake


I personally use request-native-promise and it is as easy as it gets. Agree sometimes Cljs libs are less than ideal on node. It depends on the lib of course


@U053032QC AFAIR kvlt needs the request library


@lspector I suppose you have already considered the idea of having students run a VM on their personal machines, e.g. using VirtualBox, and you provide pre-installed versions of all software they will use inside of that VM?


That potentially leads to the learning curve of Linux, if the VM is Linux, though.


@andy.fingerhut yes, I've considered that from time to time, but aside from the learning curve of the VM, and my learning curve of setting this up (alas, non-trivial), it's really a lot better if the students are using a thing that they can also do on their own, without being tied into the support system of a specific class


sure, makes sense.


BTW the #calva-dev folks are really responsive and I'm thinking that VS Code + Calva Clojure Formatter + Clojure Warrior (for better bracket matching) might be the answer I've been looking for


@lspector I know you’ve rejected Cursive for other reasons, but FWIW it doesn’t require Java (it will use the JRE bundled with IntelliJ) and it will download lein automatically and put it in the right place etc, so you essentially don’t need to set up lein either.


Pretty much all CLJS paths require Clojure, which means you need Java somehow. Self-hosted is still tricky and considered relatively fringe AFAIK.


Oooo @cfleming that's good to know about Cursive, to which I may some day return! For now, though, I think that that VS Code/Calva has a somewhat better beginner story. Appreciate the clarification of the bigger picture re: needing Java too


One day I may actually finish the standalone version!

❤️ 5

BTW what do Clojure Bridge do?


@phill It varies, I think - lots of them used to use NightCode or LightTable. I think a few use these days, but I haven’t kept up recently.


I was reading through the Atom implementation details and I noticed that in the deftype Atom signature it is defined 4 four args. The 4th being watches. However, it seems that you cannot actually pass :watches ... to Atom They have to be passed in with add-watch. Curious what the reason is 🙂 (just for learning)