r/Clojure • u/kunqananaa • Sep 24 '19
Clojure guide for new Clojurists
Hey I rarely post here anything and just mostly ghost around and read what other people are talking about. But that changes now.
I have been working on open source guide for learning Clojure. I have been trying to keep more practical/pragmatic approach in comparison to many books I have been reading. The guide is not even remotely complete yet, but I think it is far enough for me to share it with you. The guide is called It Starts With Clojure, and it is currently available in Github at
https://github.com/anan44/it-starts-with-clojure
I would really like some feedback and to hear what you guys think about feasibility of learning source like this for upcoming Clojurists. I feel like the Clojure Ecosystem is kinda short on materials like this.
The course expects the reader to have some programming knowledge, but unlike many other materials it does not make assumptions that the background would be Java. It also aims to prepare the reader to actually create real applications instead of all the niceties of FP paradigm (even though I plan to cover some of that too). I also try to keep it well hyperlinked to other sources. In no way am I trying to replace existing resources but rather to compliment them. Also my goal is to keep this as a living document that can evolve, so it won't become obsolete or outdated.
I would really appreciate if you would give even few minutes to write your thoughts on this. Thanks!
5
u/totemo Sep 25 '19
On the TODOs:
Installation of Java on Linux varies by distribution. On Fedora, the package names and even the package manager has changed over time. On Ubuntu there are similar complications. However, if you're smart enough to work out Linux, you can work out how to install Java.
On Ubuntu 18.04:
sudo apt-get update
sudo apt-get install openjdk-11-jdkGetting Java 12 on Ubuntu 18.04 requires a PPA and is probably more trouble than an intro guide needs to go into. Maybe Ubuntu 19.04 repositories have a later Java version. IDK.
On Fedora 30 (and later):
sudo dnf install java-1.8.0-openjdk-devel
# OR:
sudo dnf install java-11-openjdk-devel
# OR:
sudo dnf install java-latest-openjdk-devel # Currently, Java 12 Clojure installation:
On any Linux distribution, you can get the latest Clojure by following the instructions on clojure.org.
Ubuntu 18.04: you can get Clojure 1.9 with
sudo apt-get install clojureFedora 30:
sudo dnf install clojuregets you Clojure 1.7.0. Bleagh.
3
u/kunqananaa Sep 25 '19
Thank you so much! I’ll just pop this in when i get home. Or if you want to be a contributor you can make a pull request to the repo.
1
u/totemo Sep 28 '19
You might want to exercise some editorial discretion on the github site in relation to my comment (above) . :) My objective was to provide you the information but I wasn't expecting the comment to be reproduced verbatim. For example, my reflection on the difficulty of getting Java 12 on Ubuntu 18.04 could be omitted for the sake of concision. The same with the Clojure package versions. It would suffice to say that the best way to install Clojure is via the instructions on clojure.org and installing it via packages is likely to give you something out of date.
1
u/kunqananaa Sep 28 '19
I am planning to look into it later when I have time. I just trew it there since it is still much better than ”Todo”.
Write first, edit later. :)
7
u/sahilmuthoo Sep 24 '19
I love the practical project based approach. I've been meaning to learn Clojure propely with a real-world project.
I spent some time dabbling but lost motivation. Your guide has rekindled my desire.
Expect more comments and questions on GitHub. Cheers!
4
u/tincholio Sep 26 '19
That looks super promising! I'm trying to get some co-workers started with Clojure, and I think your guide will be a nice starting point!
1
u/Eno6ohng Sep 25 '19
This looks very promising! Have you thought of hosting it as a book on https://readthedocs.org or a similar site?
2
u/kunqananaa Sep 27 '19
I have not really give that much though for hosting it on this kinda site. That sounds like a worth looking into.
Long term plan is to write front end for this guide and host it under its own domain.
1
u/pLeThOrAx Sep 25 '19
That's awesome! Thank you. will definitely check it out and get back to you :) as a noob to clojure coming from a non-java background, it's been hard connecting the interop dots so to speak. Some things aren't always immediately obvious, and sometimes a little intuition goes a long way. Saving this post!
1
u/kunqananaa Sep 25 '19
I have not covered the interop yet, but I intend to. Book called Programming Clojure by Alex Miller covers this topic rather nicely. If you are eager to get there before I finish my guide.
1
u/slifin Sep 27 '19
Feels like we need to unify our efforts here: https://clojure.org/guides/getting_started, since that's where I would expect newcomers to arrive
The main thing that is hard to teach, always a moving target, opinionated, and super important for Clojure is editors and their REPLs and their editing modes, I know I departed this community years ago because I thought it was impossible to edit a lisp sanely
1
u/kunqananaa Sep 27 '19
My first trial with Clojure was in 2015 and I also gave up because editors made the whole thing unpleasant. Later I tried again and overcame the issue. One of my goals is that one else has to give up for silly reason as editors.
Once the guide becomes more complete, I will defintelly see about possibilities of getting it included on the official page/guides. For now the guide is not quite there yet. But we are definitelly moving to the right direction.
0
u/olymk2 Sep 25 '19
Advise on mocking / stubbing with i am trying to mock out calls to an external web page which uses clj-http client I would like to stub this out and give the returned result so i can test my logic in different situations, searching a bit I came across spec instrument which seems like it does what I want.
How ever i am strugling to get this to work all the examples I have found operate on function in the current namespace, if i am mocking from another namespace or external library do i need a fully namespace path or can i mock out globally for the duration of the test ?
Open to using other libraries but if i can do it with spec that's one less requirement.
6
u/the_whalerus Sep 25 '19
I haven’t perused the whole guide yet (mobile) but I wanted to say the hardest part for me learning Clojure has been the build tooling.
I’m a js guy and am only vaguely familiar with Java, so getting my head around all the jvm concepts has been the most challenging thing.