Fork me on GitHub

Hello Clojure-experts! I've been trying to learn clojure/script for quite some time know but I'm struggling with moving forward. I'm not a professional programmer but more of an enthusiastic amateur. I read a couple of books, did the exercism track and solved quite a few 4clojure problems ("middle"-difficulty is usually not a big challenge). I'd like to be able to build anything useful, so I thought learning about simple web-applications might be a good way. I looked into the "web development with clojure" book but I feel like it's way too much for someone who has no real prior knowledge of web development. I've been working through the "" ebook and although I've already learnt quite a lot and I'm able to understand most of the explanations, I get totally lost when it comes to the later section's "capstone"-projects. They are very convoluted and complex and I cannot follow the logic of all the different parts. Understanding the functions and code itself is not really an issue I just don't get how it all works as a whole. Apparently I'm still in need of more guidance. Maybe some of the more experienced clojurists can offer some advice on how to continue from here? Maybe you know of some resources which can take my hand and lead me to this next step in learning how to write simple applications?

oxalorg (Mitesh)11:03:33

Hey dominikk! Welcome to the clojure community 🙂 Great work on doing 4clojure and other exercises by youself! 🚀 When you say "simple applications", do you want to write a simple backend (w/ server rendered html pages) or a clojurescript frontend Single page application? Shameless self plug here but I have a video which helps you create a simple todo application in Clojurescript: I've heard from a few folks that they were able to follow it along quite well! Maybe give it a try?


hey! Thanks for the fast reply. I actually watched your videos (and set up the project myself) before I started reading the learn-clojurescript ebook. I liked it a lot and it helped me getting started! I was actually kind of sad the 3rd video you announced in part 2 apparently never came to be, because the other ones where so helpful. Back then I was also still struggling with the tooling and was quite occupied with keeping all the moving parts working 🙂 I was thinking about starting with front-end and after learning enough extending this by connecting it to a database of some sort. I'm an avid rock climber and creating an app to log the routes I climbed (doing some statistics about difficulties etc.) seemed like a neat exercise.

oxalorg (Mitesh)12:03:14

Thanks! Glad you found them helpful! :dancer: > I was actually kind of sad the 3rd video you announced in part 2 apparently never came to be, because the other ones where so helpful Sorry about this I just got confused on how I should proceed and what would be the best thing to explain next. > I'm an avid rock climber and creating an app to log the routes I climbed (doing some statistics about difficulties etc.) seemed like a neat exercise. Would you mind if I ask you a bunch more questions? I'm working on something new ( to help introduce people to full stack web development in clojure out and this seems like the perfect use-case. 1. Do you have prior experience with web app development? If so which frameworks/languages? 2. Have you created dynamic or static websites before? 3. Have you deployed them? 4. Did you setup an editor for running Clojure code? If so which one? 5. Were you able to "evaluate" code from the editor by sending it to the REPL? 6. Do you understand how HTTP works? HTTP status, body parameteres, POST vs GET, etc? 7. Have you worked with a database before? If so which one? 8. Are you familiar with git and command line/terminal? 9. Why did you decide to learn clj/cljs? Sorry for bombarding you with these questions haha!


Thank you for your input, I'm happy to answer your questions: 1. no 2. when I was a teenager some 20 years ago 🙂 3. I had a very simple website back then but "deploy" sounds a bit to big of a word 4. Emacs, using cider and kondo. Works great. The ebook showed me how to setup figwheel. 5. yes 6. I know the basics but mostly from a theoretical perspective. Very little practical experience 7. I learned about relational databases using "access". Does that count? 🙂 8. yes, not a bash expert but I'm able to use it for everyday tasks. 9. I had a colleague who is a commonLisp fan. Got interested and fascinated. Clojure seemed more practical than standard commonLisp.


I need to check again. The last time I looked at it I got confused and did not understand if it's supposed to be a structured lesson or more of a collection of separated topics. Maybe know, with more knowledge about tooling and libraries I can make sense of it.

oxalorg (Mitesh)15:03:18

Thank you this was really really helpful to understand the gaps in current resources! Sorry I don't have very specific advise for you here except for just fighting through and figuring stuff out, but there are some great videos by Practicalli, and On the code again as well.

oxalorg (Mitesh)15:03:07

I will also be glad to get on a pairing session if you ever need any help, or feel free to ping me personally!


Thank you, that's very kind! Maybe my approach of studying until I feel like I know everything was a bit off. I decided to be optimistic and just start with my exercise project. I'll just see how it goes and solve problems on the way. Thank you for your input!

🙌 1
Michaël Salihi08:04:58

You can also take a look at Easy and quick to run, commented and you'll learn some basics like: • Run a server in Clojure • How routing basically works in conjunction of Ring: • How to use Clojure Atom (mutable state) • Hiccup (the defacto Clojure html "template language")


(keyword "x" "1")
=> :x/1
=> ExceptionInfo
Syntax error reading source at (REPL:298:1).
Invalid token: :x/1
This doesn't make sense. Can anyone explain please?

oxalorg (Mitesh)12:03:22

Keywords like vars/symbols shouldn't start with numbers. Although something like this: :123 works, it isn't conforming to the spec and will break things like destructuring etc.


;; keyword does not validate input strings for ns and name, and may
;; return improper keywords with undefined behavior for non-conformant
;; ns and name.


Ah, thanks. Didn't catch that part.


Keywords are cool, but conversion to/from strings can cause issues 🙈 It’s pretty normal to turn map-keys into keywords when reading json, for instance, but json object-keys can be strings with spaces. And it’ll work fine up until you serialize and deserialize the data.

(->> {"stringWithoutSpaces" "ok"
      "string with some spaces" "not ok"}
     (into {} (map (fn [[k v]] [(keyword k) v])))
     (into {} (map (fn [[k v]] [(name k) v]))))
; => {"stringWithoutSpaces" "ok", "string with some spaces" "not ok"}
(->> {"stringWithoutSpaces" "ok"
      "string with some spaces" "not ok"}
     (into {} (map (fn [[k v]] [(keyword k) v])))
; => The map literal starting with :stringWithoutSpaces contains 7 form(s). Map literals must contain an even number of forms. [at <repl>:1:1]


@UDB2Q0W13 thanks for highlighting that. I've also noticed that sometimes the namespace portion gets lost when doing JS interop stuff.


I can't remember what is the function to do this -> [[1] [2]] -> [1 2]


flatten (not advised),or apply concat then wrap in vec, mapcat conj . probably something simpler i can’t think of either.


(into [] cat [[1] [2]])


This uses transducers, so you might actually get more out of it than simply flatten or mapcat conj


flatten is really not a good idea


mapcat identity


out of curiosity, why is flatten not a good idea?


@U013F1Q1R7G @fabrao flatten is recursive. So (flatten [[[2]] [[3]]]) gives (2 3) if you don't know what the items in a sequence are going to be (mapcat identity [[[2]] [[3]]]) gives more reliable results (flattening only one level)


I remember now, it flatten thank you


flatten gives you (1 2) not [1 2]


yes, so (into []) to it


Since you anyway have to do an (into [] then cat would be preferable


OF course, it would not matter very much for small vectors


howdy y'all is this the easiest way to build an electron app for clojure

😢 1

hasn't been updated in a while