Fork me on GitHub

no, I doubt anyone is using logic programming for that, I don't think it is a good fit


it sounds like you want to model a process over time, which, I think the gold standard for is still a finite state machine


e.g. if you are in state S0 you can do E1, E2, or E3, if you do E1 or E2 you move to state S1 where you can do E4, and if you do E3 you move to S2 where you can do E5 or E6, etc


what are describing is very similar to something like session types as well, which are usually built on a fsm


one way to describe that kind of thing would be for each state give a set of valid json-schemas, and what state to transition to given a schema match


ubf's schema language is kind of an example of that, but doesn't use json schema (


Right. I’m half embarrassed that I never thought of this. I use FSMs for all sorts of things in GUIs already….


A visualized FSM would be super easy to communicate with as well


I dunno, specifying process behavior vs. just specifying messages processes exchange still seems very bleeding edge.


it is an area of interest, but I haven't seen a lot of it used in practice


I think maybe because most exposed public apis tend to be "stateless" rest things


fulcro has a story about state machines, but I didn’t find the time to study the framework in full so far


(a UI framework for clojure)


once you have a finite state machine as data, that is a kind of relational thing, so there might be interesting things you can do querying the fsm with something like core.logic


Dammit I wanted so sleep early tonight. But thanks a lot @hiredman!❤️


Hi Everyone, I've been trying to look for a good way to parse KML (XML for GIS) into dataframe format or to export as a CSV Am considering on making my own library for this. I understand there is and data.xml. Are there any good examples for the usage of these libraries? And does making my own library to do this make sense? Or is the best/own way to make use of data.xml/zip and modify it accordingly to parameters of the kml?


Converting XML to CSV is very straightforward in Clojure, you can definitely use existing libraries. About “dataframes”: in Clojure those are generally unnecessary as the language itself provides plenty of simple abstractions to process data that exceeds available memory. But if you need to interop with other tools that require them, then that’s another case. Curious to know more details and we can discuss further.


Hmmm am doing a data science project with my friends. And for their sake am trying to convert KML into CSV so it is easily for them to manipulate it from there. (They are using python.) Usually people use a command line tool called ogr2ogr for this. But the description (one of the columns) is left as an xml string. Was trying to see if I can do the processing for them within clojyee


Do you have an example of the XML you’re trying to convert to CSV? Is it 2 dimensional?


Was using this as a test example it is a zip file with 5 datasets of the same format


I believe it is 2-dimensional(?)


(ns scratch
  (:require [ :refer :all :as x])
  (:import ( StringReader)))

(let [input-xml (StringReader. (slurp "/Users/raspasov/Downloads/dengue-cases/dengue-cases-central-kml.kml"))]
  (x/parse input-xml))
From here on, you can extract whatever you need from the XML data tree.


Via regular Clojure functions like map, filter, get-in, etc


I did exactly that actually. Guess I need to manually explore the data hahaha. The hierarchical nature of the xml can be quite daunting


Thanks for your help though :)


Yea… I was just looking at it, it looks messy this one, if the xml has some sort of a data spec or fields listed, that can help


I'm not sure if I just picked a horribly confusing dataset or if that's just kml specifications in general


Thats why I was considering a wrapper to skip some of that


Yea if there’s anything like that, perhaps worth a look; but it does look confusing (especially if it lacks explanation/specification)


I even see HTML tables in there! Doesn’t look very clean 🙂


Ahhhh okay thats html and not xml right right


Yeahhhh ... the government datasets are not very clean ...


It is XML, but there were some HTML strings I saw


Right the HTML is part of the specification


I'm trying to follow the guide for installing Clojure CLI tools on a WSL2 Ubuntu-20.04 VM (Linux within Windows): Right away I'm seeing Java, but the command sudo apt-get install openjdk-8-jre specified here for Ubuntu does not work Not sure what's wrong with the suggested command. May also need help with the rest of the installations.


Well, Java 8 is ancient. Install 14 at least.


(11 if you must)


apt-get may not be there by default, newer ubuntu versions tend to use apt install


I posted a link in that long thread that basically said: sudo apt install default-jdk which I would assume would install a more modern version.


(personally, I go to the Adopt OpenJDK site and install specific versions from there -- and I usually have three or four JDK versions installed)


also you probably don't need a full jdk (a jvm works fine until you are writing java code) and the default jvm (at one point at least) is a headless one with no gui or image processing classes included, you might not want that either


Hmm, I hadn't even thought about that. I've always installed a JDK rather than a JRE for years... maybe even for decades...


once upon a time it was a popular way to make a server leaner, nowadays space is cheaper haha


(both using a jre rather than jdk, and using a jre that doesn't include any gui or graphics code are in that category of "optimization" I think)


I'm sure I came across something about using Java 8. 😕


...but if 11 is LTS then maybe OK?


LTS only matters for the Oracle JVM.


We use 11 on QA/production but 14 or 15 on dev. We're close to using 16 at thing point.


The next (Oracle) LTS is 17.


OK. I'll try sudo apt install default-jdk ...thought I just installed 8 on Windows a couple of weeks ago, before I knew I was going to do it all over again in Linux. lol


Wait...will that command install the open-jdk or the oracle one?


apt won't have any proprietary packages unless you configure / add them


8 was EOL'd years ago, right?


I tried installing one of the other dependencies, rlwrap, using 'sudo apt install' earlier and it did not work, by the way.


$ rlwrap Command 'rlwrap' not found, but can be installed with: sudo apt install rlwrap $ sudo apt install rlwrap Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package rlwrap


@factorhengineering are you sure you are doing this on Ubuntu 20.x?


seanc@DESKTOP-30ICA76:~/oss$ sudo apt install rlwrap
[sudo] password for seanc:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
Use 'sudo apt autoremove' to remove it.
The following NEW packages will be installed:
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 98.2 kB of archives.
After this operation, 309 kB of additional disk space will be used.
Get:1  focal/universe amd64 rlwrap amd64 0.43-1build3 [98.2 kB]
Fetched 98.2 kB in 1s (113 kB/s)
Selecting previously unselected package rlwrap.
(Reading database ... 80478 files and directories currently installed.)
Preparing to unpack .../rlwrap_0.43-1build3_amd64.deb ...
Unpacking rlwrap (0.43-1build3) ...
Setting up rlwrap (0.43-1build3) ...
update-alternatives: using /usr/bin/rlwrap to provide /usr/bin/readline-editor (readline-editor) in auto mode
Processing triggers for man-db (2.9.1-1) ...


Have you done sudo apt update?


no. I had just tried running commands for each of the 4 dependencies listed.


Now I did that and it did a lot. 39 'Get' lines and it reports 154 things can be upgraded


....and this time the rlwrap installation worked. I'm not sure how I ever would have guessed that.


I mean not guessed, but found out about.


Thank you.


I dunno. It's hard to know what beginners don't know. I don't remember where I learned sudo apt update but it was a long time ago 😐


I guess I thought the system told you to run that command sometimes...


I have minimal linux command line experience. I know it uses 'ls' instead of 'dir', and I made a script once for scraping all the filenames from each of a series of inserted optical disks and appending them to a file. That's about it.


At least now you should be able to install brew for Linux and then the Clojure CLI 🙂


I'm not there yet....


I started with Unix back in... 1979 I guess?


I aborted the java install because I want to double check. This looks a bit much: $ sudo apt install default-jdk Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: at-spi2-core ca-certificates-java default-jdk-headless default-jre default-jre-headless fonts-dejavu-extra java-common libatk-bridge2.0-0 libatk-wrapper-java libatk-wrapper-java-jni libatk1.0-0 libatk1.0-data libatspi2.0-0 libavahi-client3 libavahi-common-data libavahi-common3 libcups2 libgif7 libice-dev libjpeg-turbo8 libjpeg8 liblcms2-2 libnspr4 libnss3 libpcsclite1 libpthread-stubs0-dev libsm-dev libx11-dev libxau-dev libxcb1-dev libxdmcp-dev libxt-dev openjdk-11-jdk openjdk-11-jdk-headless openjdk-11-jre openjdk-11-jre-headless x11proto-core-dev x11proto-dev xorg-sgml-doctools xtrans-dev Suggested packages: cups-common libice-doc liblcms2-utils pcscd libsm-doc libx11-doc libxcb-doc libxt-doc openjdk-11-demo openjdk-11-source visualvm libnss-mdns fonts-ipafont-gothic fonts-ipafont-mincho fonts-wqy-microhei | fonts-wqy-zenhei fonts-indic The following NEW packages will be installed: at-spi2-core ca-certificates-java default-jdk default-jdk-headless default-jre default-jre-headless fonts-dejavu-extra java-common libatk-bridge2.0-0 libatk-wrapper-java libatk-wrapper-java-jni libatk1.0-0 libatk1.0-data libatspi2.0-0 libavahi-client3 libavahi-common-data libavahi-common3 libcups2 libgif7 libice-dev libjpeg-turbo8 libjpeg8 liblcms2-2 libnspr4 libnss3 libpcsclite1 libpthread-stubs0-dev libsm-dev libx11-dev libxau-dev libxcb1-dev libxdmcp-dev libxt-dev openjdk-11-jdk openjdk-11-jdk-headless openjdk-11-jre openjdk-11-jre-headless x11proto-core-dev x11proto-dev xorg-sgml-doctools xtrans-dev 0 upgraded, 41 newly installed, 0 to remove and 0 not upgraded. Need to get 266 MB of archives. After this operation, 426 MB of additional disk space will be used. Do you want to continue? [Y/n] n Abort.


Huh? Looks fine to me.


You have a new system. It's missing a lot of stuff you need for development work.


OK. Something about having multiple 'jre' and multiple 'jdk' and multiple 'headless' looked fishy.


No great reason...just seemed excessive. Ha ha.


This all looks like perfectly reasonable dependencies to me...


I notice it's V11, by the way. Older than you were hoping for?


You can install 14 or 15 later.


As long as you're past 9 you're mostly fine 🙂


The installation guide only refers to 'brew' for mac, not linux.


Under Linux the next step it lists is: To install with the Linux script installer: 1. Ensure that the following dependencies are installed: bash, curl, rlwrap, and Java. 2. Use the linux-install script to download and run the install, which will create the executables /usr/local/bin/clj, /usr/local/bin/clojure, and the directory /usr/local/lib/clojure:

curl -O 
chmod +x
sudo ./


So what? Once you have brew installed on Linux, you're golden.


Why would it list two different ways if the same way can be used for both OSs? Not disputing you, just wondering why they would complicate things like that.


Because they didn't think to list brew as a way to do it on Linux.


$ sudo apt install brew Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package brew ;?


The Linux instructions mean every single update is manual and you have to repeat the process for every new version.


and I don't get what the text of step 2 means. Does it just mean run the 3 commands listed under it, or is it a separate command I'm supposed to know how to piece together from the text?


What are you talking about? What's "step 2"


"Use the linux-install script to download and run the install, which will create the executables.........


Just curious


Stop following those instructions. Read


So for the brew method, I need to run:

/bin/bash -c "$(curl -fsSL )"


What? That's not on the page I posted is it?


From that page: "Install Instructions for a supported install of Homebrew on Linux are on the"


....then on that page: "Install Homebrew

/bin/bash -c "$(curl -fsSL )"
Paste that in a macOS Terminal or Linux shell prompt."


I don't remember. I installed this stuff so long ago. Just do whatever it says.


It's all a one-off. Once you're done with this, keeping stuff up to date is easy.


(which is why no one remembers exactly what steps are involved -- we do this once per system and forget it!)

👍 3

While I wait for this to install, I'm marvelling again at the sheer number of steps it takes to get going with clojure/clojurescript. At this point I'm not even letting it bother me, and just laughing at it.


It's not fair to clojure to conflate different things together. WSL, brew, emacs, the linux shell in general have nothing to do with clojure in particular, they're just tools that might make you more productive with it. After all, for most of us it all builds up organically. I don't think many try to do it all at once like you did. First you become accustomed to the linux shell Then you start playing with clojure Finally you consider switching to a different editor In no particular order. This process might even span years.

☝️ 3

Agreed. I started with a system that was already setup for Java development: Clojure was almost nothing on top of that.

👍 3

Now that the effort put into setting up the VM is getting higher, I should ask: What, if anything, would cause it to be wiped?


'exit' and 'shutdown' are safe, but is there anything to be wary of?


Wow this is a huge installation...5 minutes and counting I think.


Let me tell you about that time when I tried installing Gentoo Linux on a 85 MHz Sparcstation 5. After 7 straight days (iirc) of compiling the bootstrap environment the hardware finally gave up 🙂

😂 3

How does HW give up? Blue smoke?


I think it was the SCSI controller on the motherboard that broke. Wouldn't access the disk anymore 😢


Honestly I did 2 full install last month. From blank system to clojurescript reframe running. It was 2 hours on mac book. Full install with word and nas setup... dont feel it heavy


brew installed. noticed this error: Warning: /home/linuxbrew/.linuxbrew/bin is not in your PATH.


@factorhengineering right, follow the instructions on the link I provided to adjust your path based on whatever shell you're using.


Again, I don't remember this because it was a one-off ages ago and you never have to worry about it again.


I don't think this is a "sheer number of steps" because it's just getting a bare system to a baseline that you can do anything useful with it. Neither Windows, nor macOS, nor Linux come setup to do JVM-based development.


Systems aren't designed for developers, they're designed for consumers. Developers always have to go through a setup process.


I just got through the main installation and running all the suggested commands at the end of it. (4 more commands, for installing build-essential, for setting the path suggested, and for installing gcc)


When you can do clojure -Sdescribe you'll be done 🙂


And now I've finished running

brew install clojure/tools/clojure


I just ran 'clojure' expecting a short message describing options or something. Instead it did a bunch of downloads and I'm into what looks like a REPL


Do I need to mess with the path, like you were mentioning?


(! 532)-> clojure -Sdescribe
{:version ""
 :config-files ["/usr/local/Cellar/[email protected]/" "/Users/sean/.clojure/deps.edn" ]
 :config-user "/Users/sean/.clojure/deps.edn"
 :config-project "deps.edn"
 :install-dir "/usr/local/Cellar/[email protected]/"
 :config-dir "/Users/sean/.clojure"
 :cache-dir "/Users/sean/.clojure/.cpcache"
 :force false
 :repro false
 :main-aliases ""
 :repl-aliases ""}


...or I guess brew's defaults were fine?


If that works, apparently not.


How do I get out of the REPL? I'm sure 'exit' worked in Windows


That would have been my 117th guess. 😕


(that's end of file in everything -- except Windows where it is control-z for some bizarre reason)


Windows breaks everything 😞


I did try Ctrl-c


Here's my Sdescribe: $ clojure -Sdescribe {:version "" :config-files ["/home/linuxbrew/.linuxbrew/Cellar/clojure/" "/home/a/.clojure/deps.edn" ] :config-user "/home/a/.clojure/deps.edn" :config-project "deps.edn" :install-dir "/home/linuxbrew/.linuxbrew/Cellar/clojure/" :config-dir "/home/a/.clojure" :cache-dir "/home/a/.clojure/.cpcache" :force false :repro false :main-aliases "" :repl-aliases ""}


Welcome to Clojure!


Well, the kids will be up in 3 hours, so this seems like a good pausing point for a couple of reasons!


Thanks again for the help, Sean et al.


Glad to get you this far. Sorry it's been a painful process.


Oh...again. Anything that would make my VM forget all this installations? ...things I should avoid?


Don't worry about it.


Ok. Will restart my computer with abandon going forward.


Have a good night!


Seriously, I've been developing this way for months, rebooting my laptop whenever it needs it. It's fine.


I always pictures VMs as ephemeral. Shows what I know...


I don't know where people get that idea?


I think I picture a RAMdisk actually.


Really? That feels so... '90s... to me 🙂


(which is kinda weird since I've been doing "this" since the very early '80s)


These days I just sort of expect the "cloud" to stay around until I delete it...


A virtual reality headset comes off easily?


I'm too old for VR 🙂


and I'm never continuing a game when I put it back on? I'm always starting a new one. It would feel kind of weird to 'pause' a VR game, but maybe that's just because all the ones I have are short-burst ones.


No no no. Try it!


Beat Saber is amazing, fun, and good for you!! Not many other places in life you can get that deal.


I'm 58. I've never played video games or computer games. Except Myst for a while.


(I even bought Myst for my iPhone at one point -- such a beautiful game!)


We'll have to talk about that another time. I haven't seen that one. Goodnight!


then im not the oldest person here. IM 53 🙂


I feel clojurian are older than on other language. Do we have statistics ?


When I say older, I say wiser, experimented !!

Tim Robinson10:01:07

I'm 54. I've just started clojure and I think I'm now a better programmer than I've ever been

👍 9
👏 3

LIke I said im 53 and tried several times clojure and I hope it will click this time

Tim Robinson10:01:20

Anyway I came here to ask a real question: in c# or JavaScript if I want to say if (widget != null && widget.InStock) I can abbreviate it to if (widget?.InStock. - c# calls it "null conditional" and js calls it "optional chaining". In clojure I'm doing (if (and widget (widget :in-stock))) . is there any shorter way of expressing that?


Maybe can do (get widget :in-stock)? works with nil.

Max Deineko11:01:46

There's also some-> and some->> .


or even (if-let [foo (get widget :in-stock)] foo-is-there foo-isnt-there)


I believe just (if (:in-stock widget) would work too? (widget :in-stock) throws when widget is nil but the other way round you get nil on a nil map (same as with get)


yes if you just want to check the existence (:in-stock widget) would be the shortest, if you'd like to do something with the result, can use if-let. As you noticed, you cannot call a nil value, the other way is fine. using get just makes it consistent and safer 🙂

Tim Robinson11:01:42

wow thanks. As always there are several different ways of expressing the same thing 🙂 As a beginner I find I usually start by writing something that works but is bulky using the methods I know, then learn new ways to express it better


May the REPL be with you 🙏:skin-tone-3:

Pavel Klavík16:01:10

I am assuming that widget is suppose to be a map or nil. Then the following works:

(if (:in-stock widget)

Pavel Klavík16:01:43

I am always using the form (:key m) instead of (m :key) since the latter fails when m is nil. But the former just returns nil.

Pavel Klavík16:01:09

Ok, actually posted above already 🙂 didn't notice before.


Hi, I come from Java and I have learnt a little bit of Clojure reading “Living Clojure” book. I would like to study the web stack now, in order to get chance to be hired as Clojure dev. I was thinking to buy this book, do you think it’s a good idea? Thanks

👍 3
Jorge Tovar17:01:07

Hello, there is a way un clojure to get the key looking up by the value?

Alex Miller (Clojure team)17:01:12

quickly, no. you can walk through the map entries to find a match, or use something like to invert the map then do the lookup (probably better if you're going to do that more than once)

👍 3

I bet somebody has a bimap implementation if you need to go both ways throughout the lifetime of the collection (if not guava has one )

Alex Miller (Clojure team)18:01:56

Guava's is of course mutable


a bimap is a sign you want a structure indexed by more than one field, less like a map, more like a database

ryan echternacht19:01:38

If I have 2 lists, and want to combine them like below, what's the best way to do it?

(1 2) + (3 4) => (1 2 3 4)
The best I've found is (into (vec list-1) list-2) which seems convoluted. I don't really care about the final collection type (it's getting serialized to json) I guess I should add, for my use case, the ordering is important, and that's what Im trying to avoid spoiling

R.A. Porter19:01:34

(concat l1 l2) should give you what you want.

ryan echternacht19:01:08

thanks. i can't believe i forgot about concat. i guess i've been playing with transducers and using into too much 😕

ryan echternacht19:01:24

forgot about concat


(into [1 2 3] [4 5 6])


[1 2 3 4 5 6]


Into probably better than concat... assuming this still stands

Alex Miller (Clojure team)20:01:14

this still stands, it's just contextual to how you're using concat. definitely something to be aware of in a loop but as a single thing, no worries

Alex Miller (Clojure team)20:01:59

concat is totally fine for the original case (and what I would prefer there)

Alex Miller (Clojure team)20:01:58

user=> (time (dotimes [_ 10000] (concat '(1 2 3) '(4 5 6))))
"Elapsed time: 1.036309 msecs"
user=> (time (dotimes [_ 10000] (into [1 2 3] [4 5 6])))
"Elapsed time: 5.810941 msecs"

Alex Miller (Clojure team)20:01:38

things to note - into uses conj and conj on lists prepends, so (into '(1 2 3) '(4 5 6)) is not the same. and secondly, the timings here depend on laziness of concat.


Is there a way to print all the aliases that a project has, using Clojure cli?


Since deps.edn is "just" an EDN file, you can slurp it in, run clojure.edn/read-string on it and get a hash map, and then select :aliases from that and print the keys of that.


But bear in mind that any running program started from the CLI could actually have been started with any aliases from either the system deps.edn file or the user deps.edn file.


Sweet, thanks!


If you want to also get at the content of those, you're going to need to use tools.deps.alpha as a library to compute the full project basis. Take a look at how depstar does it:


(you would only need the t/find-edn-maps and t/merge-edns parts)


Thank you very much for taking the time answering all these stuff!


Commas are whitespace in Clojure and the comma here just causes my editor's paren management plugin to leave the ) on that line instead of "correcting" it to the end of the line above, which makes it easier to put the cursor at the end of the form on the previous line so it is easier to eval to the REPL.


Otherwise I'd have to either put my cursor at the start of the form or ensure it was placed correctly relative to what would be )) at the end of the form (to ensure the nested form was eval'd and not the enclosing comment form which would produce nil instead).


Oh I see, that’s a good tip. Thanks!

Dimitar Uzunov20:01:46

hi, this is probably trivial: Its more convenient for me to evaluate (clojure.repl/doc seq?) with C-c C-c from a file/buffer than to type it in the REPL, but I only get nil in the buffer with the file and I don’t want to keep another buffer open just for the outputs (I prefer to use a single small screen right). How do you do it? Are there other users that like repl driven development but not have an actual repl buffer open all the time?


I use lispy with Emacs and it shows the result of the evaluation inline


I think to make it work using C-c C-c you should wrap your form in a comment form

Dimitar Uzunov20:01:58

hmm for me (comment (clojure.repl/doc seq?) )


C-c C-d d will bring up the docs

parrot 6

Nearly all editor integrations for Clojure provide a way to get the docs for the symbol your cursor is on, without needing to actually eval a clojure.repl/doc form.

👏 6

Most editor integrations also have a similar way to get the source for a symbol.

Dimitar Uzunov21:01:37

just for reference I set Cider Prompt For Symbol to be dwim so I don’t have to confirm


if you eval (source source) you'll see that it prints the source. this causes a side effect of printing and returns nil


(as an aside, i love recommending (source source) or (doc doc))

Dimitar Uzunov20:01:54

sure, but the side effect is not displayed inline in cider.. maybe I should have started with that


yes. output will end up in the repl. there are several commands inside the cider-doc menu. C-c C-d and then c for clojuredocs, d for the docstring, a for apropos, e for apropos documentation, j for javadoc

Dimitar Uzunov20:01:07

whoa I forgot how many features CIDER has


yeah there's a ton. and they are quite nice


there's also #cider for cider specific questions in the future

Dimitar Uzunov20:01:35

I really like the convert the thread-first


happy to help you explore the other features

🙏 3
Dimitar Uzunov20:01:49

I have to check it out

Ralph Greaves20:01:52

Hey, gang--Ralph here! I just wanted to thank you all for providing this Slack as an avenue for those with only a few months' experience with Clojure under their belts (Me.). PS: This is my first time ever using Slack; I hope this is an alright spot to send along my personal introduction. 😅

👍 15

You're welcome here I guess. I am pretty new here and in clojure. But it seems to be a quiet place to discuss with polite people. I must confess I did not introduce as you did ! Welcome, guys are more than helpful here !


Welcome! 🙂

Thomas Tay22:01:19

Hi Ralph! I too have barely 3 months of time with Clojure, and what a fun few months it's been!

Claudio Ferreira23:01:03

Hello everyone, Lets supose i have this var: (def m {:username "sally" :profile {:name "Sally Clojurian" :address {:city "Austin" :state "TX"}}}) Why when i try to evaluate the following function doesn't return "TX"? (:state (:adress (:profile m))) => nil Thanks


Hi Maybe the mispell of adress / address ?

👍 9

Yes I ve just copy paste in repl in case I miss something. But no, its working with good spelling

Aaron Bell00:01:26

boop.core> (def m {:username "sally" :profile {:name "Sally Clojurian" :address {:city "Austin" :state "TX"}}}

boop.core> (get-in m [:profile :address :state])
boop.core> (:state (:address (:profile m)))

Aaron Bell00:01:08

You have everything right except 'adress'. It's likely, as @U018QDQGZ9Q says, the spelling.


Hi guys! I don't know if it's the right section to write this but, I d like to learn Clojure. I'm a Java developer and I'm going to try a functional language. I had to chose between elixir and Clojure and I think that as Java Dev could have sense to try Clojure. I will start to read "Clojure for the brave and true", is it a good book to start? And what about web development (frameworks, libraries...) and the future of clojure in the industry? Thank you very much


I heard good things about Getting Clojure, Programming Clojure and Elements of Clojure. I also think they complement each other, from what I heard. Getting Clojure is more introduction, Programming Clojure goes in more details, and Elements of Clojure is more phylosophical (design/structure of code). That said haven’t read them. I do personally recommend Clojure, The Essential Reference. It might not be best to learn Clojure at first, but once you know it somewhat, it’s great for deep diving further into every aspect of the core language. I also really recommend at some point you read through the official Clojure overview, reference and guides: And as a super quick intro like I want to get going in 30 minutes, I recommend the following small blog series:

👍 3

Great list. I’ll add “Joy of Clojure” - one of my favorites.


Keep asking questions, the Clojure community is one of the biggest advantages to learning Clojure

💯 3
Rowan Barnard09:01:58

I am a beginner with Clojure and have read Getting Clojure and am much of the way through Living Clojure - both great introductory books to Clojure. I think Getting Clojure does a great job of helping you understand the 'essence' of Clojure and each of it's individual 'features'. Living Clojure is a bit out of date now - the chapter on web dev with clojurescript doesn't really work any more - that was the only chapter that hasn't worked for me though - the rest all still works and it provides you with a training program to get better at clojure programming which I thought is interesting and cool, though if you are confident you can easily build your own training program.


@mircoporetti Welcome! Lots of questions there so let's try to answer them all one at a time... since you're used to the JVM, Clojure makes sense: you can even use it from your existing Java apps (we introduced Clojure at work a decade ago and initially used it as a "library" and wrote lots of new code in Clojure but used it from our legacy apps -- and gradually Clojure has taken over). That said, the mental shift from Java's OOP model, based on mutable state, to Clojure's pure immutable data can be a long haul -- so expect to get frustrated and confused and be prepared to spend quite a long time learning "functional thinking" (or, perhaps, unlearning OOP thinking)...

👍 3

I think a lot of people start off with Brave/True but it may make sense for you to continue with your existing editor, if it has a good Clojure integration, rather than trying to learn Emacs (which is what Brave/True suggests). What editor/IDE are you using for Java?


Thanks Sean for your suggestions 🙂. I have another question. I already bought the book Brave/true and I would try to read it because it's here on my desk. Can I do it using Intellij or does this book oblige you to use Emacs? If you tell me that this book is not good to start I will sell it and I will buy Living Clojure or another. Thanks


It's a perfectly good book and I'm sure you can just ignore the Emacs stuff and follow along and do the exercises in Cursive/IntelliJ. There's a #cursive channel if you need help with that.


Thank you! I'll start soon


Clojure from the Ground Up is another online resource you might like. Good books to get started include Living Clojure and Getting Clojure. There are lots of good "second books" once you start to find your feet.

👍 3

@mircoporetti here is the link to Clojure from the Ground Up:

👍 3

As far as web development, Clojure mostly eschews frameworks in favor of composing libraries. Almost all server-side web apps are built, ultimately, on top of Ring. There are several options for routing libraries (mapping URLs to handler functions) with the most popular being Compojure and Reitit I think. For HTML page generation, folks mostly either go with Hiccup (you write your HTML as Clojure data structures and Hiccup transforms them to actual HTML text) or Selmer (you write your HTML as Django-style templates and Selmer substitutes variables and handles conditionals and loops in the templates).

👍 3

I would prefer to start using it only server side returning JSON like I usually do with Spring. So I imagine that exists also a library like Jackson for java?


@mircoporetti org.clojure/data.json, Cheshire, jsonista are the three that come to mind. The former is pure Clojure, the latter two both wrap Jackson.

👍 3

I tend to point beginners at as an example of a handful of simple libraries composed together to produce a small web app that uses a database and generates HTML server-side.

👍 3

There's a whole separate world of front end development with ClojureScript (that I can't comment on much yet, but I'm started to learn that side now -- after using Clojure on the JVM for a decade 🙂 ).


As for Clojure's future, it is and will always be a niche language. But it has seen slow, steady growth ever since its introduction and it is extremely stable, and changes are made in a very conservative, careful fashion.


I believe it has been said that C++, python, Java, JavaScript, Haskell and Julia were niche languages at different points in time Certainly languages like Java, JavaScript and C++ are used by a greater number of developers commercially. The last decade has seen more people reaching out for different languages, so it's very hard to predict the future (it seems even APL is coming back). I agree that steady adoption of Clojure has been a big advantage for the language and has lead to a supportive and welcoming community.

👍 3

I think most languages are niche, until one of three things happen: * A killer app in the language blows up: for example Rails put Ruby on the map. Spark put Scala on the map. Numpy put Python on the map. * A large company becomes the shepherd of the language. Google most famously pushed Python and Go. Mozilla pushed Rust. Twitter pushed Scala. Microsoft pushed TypeScript. * A platform forces its use. Swift and ObjectiveC for Apple. C for linux. JavaScript for browsers. Java/Koltin for Android. C# for Windows and Unity.


All very good points. JavaScript is a particular good example. I don't think JavaScript was considered a serious language for a long time. Then jQuery came along (which still seems the most used library). Then more business got behind the language (even Microsoft) and of course every companies started using JavaScript for front end websites. Then node and mom came along... Although there are no guarantees that a language grows even with a 'killer app` or company support (i.e Dart from Google) or enviable platform changes. I am enjoying the diversity in languages we have experienced, even though it can add a burden to keep up. This diversity does encourage developers to thing differently about the software they write. This thinking is beneficial to Clojure as there are many subtle and important differences to discover

👍 3

and.. does Phoenix put Elixir on the map?


Elixir seems pretty niche to me.


StackOverFlow 2019 survey had Elixir and Clojure usage on par: Elixir 1.4% Clojure 1.4%


I don't know how much of that small usage is driven by Phoenix or not. And maybe Phoenix could push Elixir past Clojure in the future, that's really hard to predict


Clear, I hope that clojure will grow on 2021, I'm waiting for official statistics


Given that most of the Clojure community uses either Zulip or Slack instead of StackOverflow, you have to wonder how representative the Stack Overflow survey is for Clojure. It would be useful to get stats from Maven central and Clojars to see how often jars are downloaded. For myself, the question is never about popularity or usage, but is the language sustainable? As far as London is concerned, Clojure is certainly sustainable in terms of jobs and community. As we've all gone online then that easily extends to the whole of the UK. And there seems to be a regular stream of new companies advertising in the jobs channel. I started looking on Tuesday for a new job and found 6 Clojure roles straight away (I may have just been lucky). There seems to be more and more communities around the world too, especially over the last few years. So Clojure is still growing. We have also seen a big boost in numbers in the London Clojurians, over 2,000 members now. There are only 7,000 in the London Java Community, so there is certainly a lot of enthusiasm for Clojure.

👍 3

That's a good point about the user groups -- I was surprised to see one pop up in Provo, Utah and it's pretty active (it's done well since we all went online and it can get speakers and attendees from all over the place). I've attended that a couple of times now, and the Los Angeles group. And both San Francisco and Seattle are trying to get themselves restarted as online meetups.


Jar downloads for clojure itself could be an interesting stat to plot. If somehow it could even unique over IPs 😅


As for me, I agree with others, I don't really need Clojure to be more popular as long as it continues to be well maintained and supported. The ecosystem is healthy now, there's nothing really that I'm "in need of" or "missing". I have all the tooling and libraries/framework I need. And the language already has more features then I even know what to do with haha.


The only exception I'd say is job prospects. I would like to see it grow there. The more opportunity to work in Clojure at more places on more varied applications the better chance I can use my favorite language at work for the foreseeable future.


Thanks guys, I will start today to read something of Brain/True. I'm happy to see that all Clojurians are enthusiastic and positive about the growth of the language. I think that it will be for me a good experience to start programming with a different approach. About jobs, we will see 🙂 I believe in functional languages and their communities


All the companies I taked to this week are looking to hire more Clojure engineers this year. Location is still somewhat a factor, although mostly due to the pandemic that location is now more about the same country or economic region rather than city. There are not the same numbers of jobs as say Java or JavaScript, but the jobs I have seen in Clojure tend to be more engaging and slightly better paid.

👍 3

@mircoporetti You will also probably find this site very useful as a learning resource:


I think @jr0cket is also developing material about web development but I don't have a link handy for that.


All the books can be found here

👍 3

Ah I didn't see it as a title in that big cluster of graphics! Yes, here's the web apps link directly for @mircoporetti

👍 3

I believe it has been said that C++, python, Java, JavaScript, Haskell and Julia were niche languages at different points in time Certainly languages like Java, JavaScript and C++ are used by a greater number of developers commercially. The last decade has seen more people reaching out for different languages, so it's very hard to predict the future (it seems even APL is coming back). I agree that steady adoption of Clojure has been a big advantage for the language and has lead to a supportive and welcoming community.

👍 3