Fork me on GitHub
randomm char03:11:55

how do you run the clojure jar/repl file use to be able to do bu typing java -jar clojure.jar but doesn't work for latest one

randomm char03:11:44

doent help they really need to update that site


@mathpunk Did no one provide feedback on your questions about XML files? My recommendation would be to keep the reading separate from the processing -- so transformation functions should just take data as input and produce data as output.


@andy100jones That site has been updated a lot recently and the Getting Started page in particular has been completely overhauled since Clojure 1.8 (which was when you could last just run the single clojure.jar file).


Is there something specific you think is missing, or confusing?

randomm char05:11:23

java -jar clojure-1.9.0.jar with clojure 1.9 in the same directory its gives me tones of errors

randomm char05:11:44

I can get it to work with lein only after I manually installed lein


@andy100jones Did you find the command 'java -jar clojure-1.9.0.jar' on the page that Alex mentioned?


I don't see it there.


Oh, maybe the one way near the bottom?

randomm char05:11:06

literally cut-n-pasted it changed version number


I'll try out that last one to be sure, but yeah, that one may be out of date.


The earlier ones look like better options to me.


That's only for when you build Clojure from scratch locally, right?


(pretty much no one does that, especially beginners)


Try following the other options on that page. Clojure 1.8 was the last version where you could just take the single clojure.jar and run it like that.


That last one works, but only if you first do the 4 commands above it.

randomm char05:11:12

there is a way but cant remmerb fro thelife of me where I found the info


And as Sean mentioned, that is mainly useful if you want to make changes to Clojure and try those out. Most people use it as it is released using one of the earlier methods on that page.


(1.8 was nearly three years ago)


@andy100jones Are you on Windows, Mac, or Linux?

randomm char05:11:17

well the getting started page hasnt change since then 😛


Yes, it has changed a lot.


The Clojure Installer and CLI tools section at the top is all very recently added.


Yeah, as mentioned there Leiningen or Boot are probably better choices on a Windows system.


If you're on Windows 10, you could always try the WSL (Windows Subsystem for Linux) -- that's how I run most Clojure stuff on Windows.


Or Sean has probably had success using WSL on Windows and the Unix methods.

randomm char05:11:45

well can get it working fine with lein after some finagling


Otherwise, lein or boot are going to be your choices for Windows. A version of the new CLI tools is coming for Windows (via PowerShell) but it'll be a while.


Cool. Yeah, lein should get you going on Windows.


I have a c:\tools folder in Windows and added it to my PATH, and I just put lein.bat in there, next to boot.exe 🙂

randomm char06:11:59

woot found it gotta do java -cp clojure-1.9.0.jar;spec.alpha-0.2.176.jar;core.specs.alpha-0.2.44.jar clojure.main


lein.bat repl or boot.exe repl would be easier 🙂

randomm char06:11:22

so who ever maintains where it says "Other ways to run Clojure " need to add some info in there

randomm char06:11:11

well 1.8 yeh didnt need to add the extra jar files


@andy100jones The example with running clojure.jar is correct -- if you follow the actual steps shown.

randomm char06:11:53

where yeh get ant from?


Andy tried the instructions, as written, and reported above that they do work.


Searching for install ant windows gets me to this page

randomm char06:11:10

and yeh gotta intall git?


That's why that section is way down the page -- and is only intended for people who want to build Clojure locally and run it. You've skipped over a lot of options to get to that point 🙂


I get your point tho'... I'm mostly just teasing.

randomm char06:11:54

yup was looking for simple and fast at the time just wanted to check it out


It's unfortunate, but Windows has never been the favored platform for development with Clojure.


Leiningen is definitely the easiest way to get up and running on Windows. Boot is also a good option.


When the PowerShell version of the CLI tools is finished, that'll be a good option.


Unless you're willing to use WSL on Windows 10 -- which gives you full access to all the Linux tools.

randomm char06:11:12

well at thie point think just t do a few test runs doing it on would be faster

randomm char06:11:05

was checking out wsl its interesting not sure I like it though just feels weird 😛


Yeah, much will depend on your background. I grew up on Unix so Linux seems natural to me but it can feel pretty old-school for a lot of folks 🙂


I've had Macs since around '92 -- and, back then, it was all GUI so I used to run Tenon Intersystems BSD Unix on Macs as well, since that's how I did all my dev work. Until Windows 10 got WSL, I didn't find it easy to do dev work on Windows...


It's also really hard to go back to windows after getting into linux

randomm char06:11:25

its all that control 🙂


FWIW, I do keep reminding Alex about the PowerShell version of the CLI tools because I would really like to use that natively on Windows, even tho' it's not my primary dev environment.

randomm char06:11:38

is there a reason there are 3 separate jar files why not put em all in one?


So that spec and the core.specs can both develop on their own schedule, independent of Clojure itself.


And that's likely to be the pattern for more parts of Clojure going forward I expect.


Clojure itself tends to get a new release about once a year. spec (and core.specs) get releases much more often.


We're seeing a similar arc with the CLI tools themselves and tools.deps (.alpha) which is getting new releases faster than even the prerelease builds of Clojure 1.10 -- or at least on a different schedule.


Yeah, I tried those instructions on my Mac laptop where java, ant, and git were already installed long ago.

randomm char06:11:38

oh well would of been nice had they put that info in the getting started page somewherer would of saved me llot of time "P


And I've submitted some patches that were accepted into Clojure's code, so have done lots of other weird things with that code, too 🙂


I do think that perhaps that last section could perhaps have a slightly more of a warning that you need to install git, java, and ant first, and it isn't recommended unless you want to develop changes to Clojure itself.


and those instructions might not even work on Windows at all, without WSL

randomm char06:11:28

well most people probably already have java but unless your really into programing already git and ant not so many gonna have that


Either I am in a weird part of the programming world where git is as common as air (possible), or perhaps it has caught on in about half and there are large swaths that still haven't started using it yet.


ant is definitely more niche of those two tools.

randomm char06:11:14

programing is an off/on thing for me read about lots

randomm char06:11:41

I knew about apache but not ant just rread up on it


Thank you, Sean, for saving me 5-10 minutes of doing something like that 🙂


The Windows section should probably actually link to the Leiningen and Boot websites but my adoc chops are rusty 🙂

randomm char06:11:04

well the java -jar still works just gotta grab 2 more jar files 😛


Ah, it has them linked at the bottom of the page... I'll do a PR to have them linked above as well...


The jar created by those instructions includes the other 2 with it. The JAR you download from Maven does not.


There are multiple ways to build Clojure, with instructions on other (not getting started, but Clojure developer) pages that show you how to build it in the way used to create the JAR made available on Maven.


Not saying you want to try out all of these ways, just FYI in case you are wondering why those instructions work but not what you tried.


The Mac and Unix ways install a program that figures out for you what those 3 jars are, and downloads and puts them on the Java command line for you, so you don't need to know what all 3 are. It just hasn't been ported to non-WSL Windows yet.


Anyway, that is the too-long way of saying what Sean did earlier, paraphrasing as "Those instructions are not optimized for non-WSL Windows users, unless you follow the lein or boot ways, which it does recommend."

randomm char06:11:29

hey while I got a live person odd qquiestion


I have tried writing README's for installing some software tools that took multiple steps, and only used by about 100 to 150 people, where I work, and found that it was nearly impossible to write them in a way that someone didn't miss a step.


I guess the main lesson I learned is: if you can, make it take only 1 step, by writing an installer for them.

randomm char06:11:58

when running a repl how do you display a function like using (source map)


what happens at a repl when you type (source map) ?


Yeah, that's why we ended up with a shell script at work. We only onboard new developers once every few years but automating it is still worthwhile.

randomm char06:11:53

user created funnction meant


Ah, yes. I don't know, and haven't dug in to find if there is a way. Putting the function in a file and loading it from there should do it, though.


Ya, just need to add more Jars to the classpath now. I do agree, it would be nice to have those instructions on that page. You could make a PR for it.


@didibus I really don't think people should be encouraged to download the individual JARs and run them like that. It's far better to encourage people to use the CLI tools (on Mac/Linux) or Leiningen/Boot on Windows.


Especially on Windows, even Lein does not always work. The lein bat file is outdated, and won't work on all Windows machine. They have a powershell script in the works also that hopefully will be better.


Maybe boot works on Windows, but I've been having a lot of problem getting Lein to run on Windows for a while now. It seems you need to debug the bat file constantly, and manually fiddle with it. So I think on Windows, using 3 jars and java is actually the easiest way.


Running the Leiningen (unix script) in GitBash is the easiest way I found to use Clojure on windows

randomm char06:11:07

had to manula install lein to get it to work 😛


Even when I do that, the bat file still can't launch it 😛


Just a curiosity question for me, do you do all your work on Windows? e.g. no Linux/Unix work?


Windows and Linux for me

randomm char06:11:12

windows main system I use bside installing linux on my ersonal amchine

randomm char06:11:31

damm cant ttype


@didibus Interesting. I've never touched the lein.bat since I downloaded it ages ago, and I've never had any problems with it. Certainly, Boot used to be absolutely awful on Windows (much like Leiningen did when it first appeared for Windows) but Boot is really pretty solid on Windows these days. Maybe you have old installs?


It is certainly possible develop in Clojure on Windows, even without WSL. Just realize that you are not on the most greased path there. If you can run WSL or Linux in a VM on top of Windows, and it doesn't cause you terrific annoyance to do so, you will see fewer build tooling issues.

randomm char06:11:20

literally just grabbed a copy from lein site and it didnt work


Exactly what "didn't work"?

randomm char06:11:00

error dowload file


I think the issue is with a recent version of Windows 10


And latest Lein

randomm char06:11:32

when running lein install


C:\Users\seanc>lein.bat version
Leiningen 2.8.1 on Java 1.8.0_191 Java HotSpot(TM) 64-Bit Server VM
That's on the very latest Fast Ring Insiders Build of Windows 10 (18277).


But maybe the .bat file is older and doesn't suffer from that bug.

randomm char06:11:11

hmmm gues Ishould install wget or curl 😛


Not sure, all I know is I got a new laptop, and lein fails to install on it. And someone else at my work had the same issue on his windows laptop trying to get lein running.


Possible something is a bit messed up with my Windows environment, but to me that's also an issue in that lein isn't very resilient


the lein.bat specifically


Note that one of the developers in the issue you linked to said something like "I don't use Windows, except to investigate bugs in the Windows installation". Hence my statement above about "not on the greased path". Mac and Unix/Linux are heavily used and greased for Clojure.


@andy100jones When you installed Leiningen on Windows, did you go to and get to this script and just save that down locally as lein.bat and put it on your path?

randomm char06:11:58

used the link on the front page


(that's also kind of a question for you @didibus -- I'm curious as to how folks are installing Leiningen on Windows)


@andy100jones That is linked from this text "Download the lein script (or on Windows lein.bat)" on the front page.


Yup, I save it to my home/bin/lein.bat which is already on my path, then I run chmod a+x on it using git bash which has chmod. I think right click, properties, and clicking on unlock would also work to allow it to run, then I go in cmd.exe and run lein.bat self-install


Where I get the download failure


OK, so if I delete the .lein folder I should be able to repro?

randomm char07:11:38

derp think the link in the lein.bat files needs to be updated gives a 505 error


Which you can get around by disabling TLS on wget. Oh ya, you need to make sure you've got curl or wget on windows, but I already had that. But after that, even once Lein is installed, I get an error when I run lein, System can not find path. And I remember having that on my old laptop also, and I needed to hack around in the .bat to fix it. This time around I could not be bottered


@didibus FYI

C:\Users\seanc\clojure>lein.bat self-install
Downloading Leiningen now...

C:\Users\seanc\clojure>lein.bat repl
nREPL server started on port 54407 on host - 
REPL-y 0.3.7, nREPL 0.2.12
Clojure 1.8.0
Java HotSpot(TM) 64-Bit Server VM 1.8.0_191-b12
    Docs: (doc function-name-here)
          (find-doc "part-of-name-here")
  Source: (source function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
    Exit: Control+D or (exit) or (quit)
 Results: Stored in vars *1, *2, *3, an exception in *e

That was after deleting the .lein folder. Sorry I can't repro 😞


Hum, ya most likely. Or just re-running the self-install


Ya, I don't know. The whole windows command line and environment is a huge mess to be honest.

randomm char07:11:33

nm getting tired 😛


I wondered if it's actually because I install MSys and git bash,and I know that does some things to the windows environment to be bale to simulate some of the unix commands on windows. Maybe that breaks some other stuff lein.bat relies on


Also, this is a corporate windows machine, and it has custom policies. So I can see maybe it being due to a policy forcing a newer version of TLS, which makes the download of lein fail.


Ah, MSys... yeah, I've heard of problems with that. I do have Git Bash installed but only the minimal version that is not supposed to interfere with the regular CMD prompt.


Maybe Boot really is the easier way to get up and running with Clojure on Windows these days?


Ya, I'll give it a try tmr. Left that laptop at work today


(I've been on a Mac for 26 years but my next desktop dev machine will be Windows so...)


Oh ya, why the switch?


Tired of Apple not innovating and also breaking dev machine setup with nearly every O/S upgrade.

Lennart Buit07:11:06

hmm, what were you experiencing that breaks


Plus not having a good touch screen story. I love my touch screen Windows laptop. I get so frustrated my 27" iMac doesn't have a touch screen!

Lennart Buit07:11:15

the only thing I need to do is keep updating xcode somehow

Lennart Buit07:11:42

all brew-installed software is left as-is


@lennart.buit Oh, macOS upgrades randomly overwrite /Developer, or break Apache, or various other things. It's driven me nuts over the years.


Like I say, 26 years on Mac and I'm just tired of it.

Lennart Buit07:11:46

I think my companies security software has a chance of breaking my system every update


I've gone full Linux on my personal computers (except my gaming PC). Did that switch 2 years ago, and I'm loving it. openSuse Tumbleweed, rolling release, real solid. It's just the best for doing dev work.

Lennart Buit07:11:11

I got sick of having to maintain my ArchLinux system, I want a dev machine, unix based, for work that just works^tm.


At least for the last 2 years, openSuse Tumbleweed has been rock solid for me. Not a single upgrade broke my system.

Lennart Buit07:11:34

The command line story on windows is just bad, Path variables still scare me and not having a package manager that works is just bad

Lennart Buit07:11:27

Yeah arch is pretty stable as well, it was mostly windows fucking up and breaking my bootloader or NVIDIAs driver hack failing


Its impossible honestly. I tried every trick in the game. Using git bash with MSYS. Installing alternate terminal apps. Using powershell. Scoop is pretty nice, but still, its just not the same.

Lennart Buit07:11:06

but that stuff always happens on that one moment you cannot handle it


Ya, it works like that lol


What I do now. At work, I have a windows laptop, and a cloud dev desktop running Linux. And I use thinlinc [] as a remote desktop tool (I tried all of them, this one is flawless and hands down the best). At home, I have a gaming PC where I game, and a laptop with Linux for my personal stuff + side project dev work.


If it wasn't for Office + Gaming, I'd be off windows and on Linux everywhere.

Lennart Buit07:11:49

Yeah I have a macbook for work and a windows machine for gaming


I haven't tried mac in a long time. Last time I used it, I think brew wasn't around. And I was annoyed about the fact you could not maximize windows 😛

Lennart Buit07:11:39

I get so annoyed when coworkers have their windows unmaximised


But I've been tempted to switch my windows laptop at work for a mac one, since the Office tools were updated for it.

Lennart Buit07:11:49

“dammit please use your entire screen”


YES! Thank you!


Spectacle looks like what I would have wanted years ago when I had a mac 😛

Lennart Buit07:11:41

the default mac-maximise is great tho if you are not using multiple screens


I think they changed it though. I just remember it used to maximize but keep the ratio fixed. So as soon as either the horizontal or vertical width was maxed out it would stop. I'd have to manually fiddle to get the other borders maximized also.

Lennart Buit07:11:37

well if you do really maximise now you get sort of a workspace with that app. So when you are just working on the builtin screen you can swipe three fingers to swap between workspaces and therefore apps


That was like 12 years ago or something

Lennart Buit07:11:11

it also hides the status bar thing on top, and the window border


Oh, I see. So its like fullscreen, but you can switch workspace?

Lennart Buit07:11:35

yeah, its basically like iOS apps, but with easier switching


I do that often in linux actually


That's not bad

Lennart Buit07:11:09

not when you are on a single screen. On multiple I get confused


Ya, I can see that

randomm char07:11:35

I think the link to the file in lein.bat is off


I used to be all windows before, even used to work at a Windows dev shop 😛


I've never been satisfied with the desktop experience on Linux so I've always preferred Mac which sort of gives the best of both worlds. And now Windows offers that via WSL so you can actually get a standard Linux (like Ubuntu) rather than Apple's weird Darwin build.


@didibus Aye, I've used every version of Windows since 3.11 (WfWG).


And I've been an Insider for years, starting with prerelease builds of 8 or 8.1 I think.


I havn't tried WSL yet. But I heard it can be pretty slow. I do have to say, KDE Plasma, is the best Linux desktop in forever, that I have used. I think I actually like it better then Windows 10.

randomm char07:11:45

I hate how MS move stuff around really get annoying from one version to another


(WSL was horribly flaky when they first flighted it -- but, build 18272 aside, it's been really solid lately)


Re: slow -- true, the I/O is pretty bad. It's good enough for dev but nothing heavy on I/O.


Compared to running a VM?


OK, bedtime. Got a long drive tomorrow 🙂 Enjoy your weekends!


Thx, you 2

randomm char07:11:52

till next time gotta catch some zzzz'z before they catch me 😛


do you think its normal for having output like that?


It's a bit strange for sure. But Clojure doesn't guarantee logical output for garbage input. The syntax of get-in takes a vector of keys.


Maybe this is something that could be fixed though. The question is, would changing the behavior break anyone?

👍 4

Yes - it does stump, but then it begs the question - what is a better return value in the get-in case when the key-seq is nil? What if it were () in case of nil? get-in ends up calling seq on the last argument, which evaluates to the same value for both nil and an empty sequence. Since get-in takes a /path/ to project, an empty path returning the original, /top level/ value is a justifiable choice.


But just to be clear - a nil value as a result would have been less of a stump, with an empty path returning the original/top-level value making more sense. It’s probably a result of using seq and depending on its semantics.

Braden Shepherdson17:11:17

I keep finding myself wanting to (update-in {:foo {:bar [a b c {:d 7}]}} [:foo :bar :peek :d] + 3)

Braden Shepherdson17:11:28

that is, I want a magic key that means "last place in the vector"


with Specter: (transform [:foo :bar LAST :d] #(+ % 3) {:foo {:bar [a b c {:d 7}]}})

👍 4
Braden Shepherdson17:11:40

(though I wish the input data was in the first position, not the last, so it would fit in with update-in and friends. I suppose I can write a macro if I need it.)


Is it possible to attach a docstring to a defmulti?


I think I see now way down in the documentation (defmulti check-me-out "this is the docstring" (fn [x] x))


what exactly about clojure enables the live coding experience via the repl?


I'm assuming it's not possible in the same way with C# or Java.


everything is constructed in such a way as to expect new code to be compiled at any arbitrary time


(or recompiled and replaced with a new definition - but there's some clojure warts there with eg. protocols and multimethods)


I've been telling people clj has a special ability in this area, and they usually counter that their language does the same...


but at that point I don't really proceed in the conversation as I don't know presumably what I'm talking about.


I use the repl via cider and love it, that's for sure.


@macrobartfast I'll give an example of my workflow: I start a REPL and connect my editor to it, then as I write code, I use a hotkey to evaluate it into the REPL from the editor (so I always write code in the editor, not in the REPL). The magic comes when you start your app from inside the REPL and can live code into the running application. Change the code, hotkey, app is updated while it is running.


We also sometimes start our apps on production with a Socket REPL enabled so, again, we can connect to them from an editor (or command line REPL elsewhere) and run diagnostic code inside the live, running production app. We have even applied patches that way occasionally. Just eval a new function definition into the live, running app and the patch is applied with zero downtime.


Stu Halloway has a couple of great talks about this sort of workflow: REPL-Driven Development (for the Chicago Clojure group) and more recently Running With Scissors from Strange Loop this year.


well, I'm super into it myself... I mean, I'm sold on it, for sure...


Those two talks should really help explain why Clojure's REPL workflow is truly different.


but I always wonder what it is about clojure that enables this... or, put it another way, could, say, a java or c# developer tweak their setup into a similar arrangement, and, if not, why?


1) Clojure can compile itself at runtime. Java and C# need to have a compilation pass first. 2) Clojure can load new code into an existing process at runtime. Java/C# must be restarted to do do so. 3) Almost every construct in Clojure can be reified. That is, swapped out and in at runtime. Not the case in Java and C#. 4) Clojure's syntax is short, concise, non ceremonial, and can be one lined. Making a REPL practical. In Java or C#, you'd go crazy. 5) Clojure defaults to immutable state and favors pure functions. This helps a lot when swapping things in and out, since it is often possible to do so without making a mess of the runtime state.


and thank you for the cool description and validation of the workflow and the video links, @seancorfield!


it's a combination of the dynamism, the concise syntax. and how relatively friendly clojure is to reloading a namespace. if Java were more dynamic than it currently is, having to define classes for everything would get in the way of a good REPL experience. Clojure's tooling also lends itself to this in thanks to nrepl and CIDER, which lets you run a REPL and interact with it remotely from your editor in a way that goes far beyond mere code evaluation


Clojure's natural compilation process is based on forms. The REPL works just like the compiler: read a form, compile it, evaluate it (define a function, compute a value). Other languages tend to have an interpreter for their REPL or some bolted-on process -- Stu actually talks about that in the RDD talk, as I recall.


for example, I often do significant work from the Node.JS repl, and my editor is even set up to let me send code to it, but re-declaring a let or const causes an error, and reloading a module requires hacking into node's module cache


and while javascript has a similar dynamism, lisp forms lend themselves better to a REPL than js syntax


I guess what it comes down to is that while it's doable in other languages/runtimes (some more than others), clojure and its ecosystem is REPL-forward


As Stu says in one of those talks (maybe both of them?), you don't really need source files or anything other than the code: you could just feed one big transcript of Lisp forms into the REPL and that would be your running program.


ok... so it's largely a tooling/approach thing.


It's that inherently "baked-in" aspect of the REPL that enables the workflow.


or... emphasis in the language and tooling.


largely. the namespaces are a big deal though. with other repls, re-declaring things through a repl's context gets hairier and you have less access to what's going on in your modules


Other languages have a fundamentally different compilation and/or evaluation model so it's much harder to have a REPL-based workflow.


Stu compares Clojure and Java specifically in one of those talks (since Java has a "REPL" now -- but it's not like Clojure's REPL).


I have found that Python interactive sessions are not terribly far from a Clojure REPL, but I suspect even with Python, there might be something missing from that experience vs. Clojure.


another example of how clojure is built with this in mind is some of the stuff we're getting in 1.10, namely pREPL, which gives you a REPL with structured output, ideal for (e.g.) socket communication, which is going to lead to even more elegant tooling for building rich REPL experiences


e.g. I don't know if anyone take a running Python application and connects to it via an interactive session while it is running


I think this is possible in hy Which is just lisp dialect written directly on top of python’s AST. That makes me think it may be possible with python.


another example: say I'm editing some - in neovim, I use vim-fireplace to connect to cider-nrepl, so I might finish my changes and then run :%Eval from vim - now if I go to the REPL, changes to the namespace I just re-evaluated will be reflected there, and if I call a function in a different namespace that uses the one I edited, those changes will be reflected


in node, if I tried to do the same thing, I'd need to nuke the node module cache of not only the module I just edited but also any dependent ones, and then re-require


not sure how that'd look with python. python at least gives a friendly REPL experience with ipython so it's a step above many other langs right there. I still find its repl limited in surprising and annoying ways


some of it comes back to syntax - python relying on indentation can lead to silly mistakes in a REPL that force you to re-enter things


with lisp, you just gotta balance your parens and you're good


well, that's all helpful... so now I understand it's just that repl driven dev is a first class citizen in clojure, but with other languages it's possible, but difficult, and possibly limited.


speaking of repl driven development, I seem to recall getting a ring server started and stopped from the buffer... is it possible to just skip the ring plugin altogether?


configuring project.clj with the plugin seems crufty and also it's hard to start/stop the server then, afaik, without restarting the repl, etc.


this might be a question for the main clojure channel, possibly.


also, you've already been generous with all your time on my other question.


I don't think I've ever used the ring plugin - others will probably have better answers on that front, but you could just have a start/stop function in some namespace and call them from the repl - or have it start automatically and then call stop or restart from the repl as needed. Some of this depends on your exact usecase though - sometimes it's nice to let things like that automatically reload for you when you make changes


I'm still a journeyman on this stuff myself though 😉


cool... that's affirming of my approach... 😉


I've never used the Ring plugin either. I just have a (comment ...) form at the bottom of several files containing common code I use when developing (Stu called these "Rich Comment Forms" in the Scissors talk -- because Rich does this too). I have stuff like

  (def system (component/start (build-system)))
  (component/stop system))
So I can just put the cursor on a form and evaluate it into the REPL. component/start will start my Ring app (and set up DB connections etc etc).


You could also do it with a defonce for your system and alter-var-root to start/stop it.


omg lol... ok... I was using the comment approach on my own (feeling smart all of a sudden ;-D )...


"Rich Comment Forms" lol


and I thought it was probably some total anti-pattern.


like, all these comment areas in my code I was using.


if there is ever an official Clojure IDE it should be called a Rich Text Editor

😆 4

because before I used comment areas, I would litter my code with function calls, forget about them, and restart the repl with interesting results.


You can also use the #_ form


Quick question: I shouldn't have to worry about doing a lein clean or closing down my repls lein repl and lein figwheel before doing a lein uberjar, right?


the uberjar task should implicitly clean


a gotcha is that sometimes you can define a cljs output target that clean doesn't recognize


but I prefer to fix that in clean-targets


will the implicit clean ever screw with my development environment?


I haven't ran into an issue yet, i don't think, but i want to deploy several times while developing (test with people, fix stuff, repeat)


it should wipe out your js output from cljs, since it would likely reflect a different build


with a careful setup you could maybe put unoptimized (dev-time) output in a place that uberjar doesn't wipe out...


but I tend to consider uberjar for release a "shut everything down and clean slate" moment, for sanity sake if nothing else


That's how I was initially treating it, too. Just because I didn't like the idea of deploying something not built from a clean slate.


Nothing seems to break, shrug


for a minimal rest server, do you use compojure, or just ring?


you'd want some router


there are good routers that aren't compojure, but ring alone doesn't get you any routing at all


bidi is pretty cool, I worked on another one called polaris


ok... probably go with compojure, but will have to wrestle with figuring out how to run it from the code as earlier discussed... have ring now running that way, which is cool.


the compojure docs are highly ring plugin oriented.


I often restart the repl from cider to clear out everything I've defined and get a fresh start... is there a way to do that from within cider without a repl restart?


I mean, I restart the repl from the terminal I start it in.


(I connect to it from cider usually)


this is what stuartsierra/component is explicitly for


hit , (comma) to get a nice menu. there is refresh which might work for your needs and also restart if you need a bit more

👍 4

right - but your code needs to be written in a way that refresh or restart work properly, which is why component etc. exist


It doesn't, if you're trying to simulate repl restart. Component is when you want to do so while re-initializing things automatically and potentially preserving state.


As far as I know


@didibus for example, it can't shut down a server that owns a port


Oh that's true. Cleaning up of resources is a good one.


I do feel though that a lot of beginners get lured into these reloaded frameworks when they don't meed them. And are just looking for cider-refresh like functionality. Not all project and setup need to initialized and cleanup resources on refresh.


(you can also do it by hand without those of course)


@dpsutton I'm using emacs in terminal, so the , doesn't work


really? that's surprising


what function is it bound to?


i have no idea




but i'm surprised that doesn't work in terminal


well, I have a lot of things in my emacs, lol, so the problem is likely on this side.


the comma prefix is an evil / spacemacs thing right?


no. it's watched for in the repl and if it sees , it shows a little menu


vestiges of common lisp, slime, etc


I'm guessing it's a spacemacs thing.


CIDER thing


it's defined in the cider-repl-mode-map


this discusses the component approach too.


You don't need component. Cider-refresh will unload everything and reload, as if you had started a fresh REPL.


the comma works for me in terminal mode. emacs -nw and when i hit , in a CIDER repl i'm given a quite nice menu


lol. and "hsata la vista" means quit


I’m trying to connect mount with ring’s run-jetty, but when I start it, the repl hangs indefinitely. This is my code:

(defstate Server
   :start (run-jetty handler {:port port})
   :stop (.stop Server))


(I don’t even know if a jetty server has the stop method)


Try adding :join false in the options to run-jetty


:join defaults to true, and blocks until the server exits.


might be some inspiration here


Thanks for the tip @manutter51 but the repl is still hanging for some reason… @dpsutton thanks for the inspiration! So stop and join must be called to stop the server….

👍 4

Ohhh it was :join? ! As the official documentation says:


Whoops, sorry, should have cut and pasted


no prob, thanks for the help