This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # babashka (63)
- # beginners (27)
- # calva (17)
- # cider (1)
- # clojure (23)
- # clojure-europe (6)
- # clojure-norway (4)
- # clojurescript (9)
- # cursive (8)
- # data-oriented-programming (9)
- # data-science (7)
- # fulcro (14)
- # graalvm (3)
- # helix (3)
- # introduce-yourself (1)
- # jobs-discuss (7)
- # membrane (40)
- # missionary (4)
- # off-topic (32)
- # pathom (60)
- # react (6)
- # releases (2)
- # shadow-cljs (4)
Why does this return true
but the following return false
(not-any? (fn [f] (f nil)) '(nil? coll?))
(not-any? (fn [f] (f nil)) (list nil? coll?)) (not-any? (fn [f] (f nil)) [nil? coll?])
Quoting means you get the literal symbols, and symbols can be invoked as functions and happen not to throw errors when invoked on nil
So the list (f x) is evaluated as the application of f to x, but '(f x) evalutes to a list of two symbols, f and x
Pedanticly, (f x) evaluates to the application of the evaluation of f to the evaluation of x
Hi! I would appreciate some suggestion on how I can get into web dev with Clojure. To get more comfortable with the language I am doing the Clojure track in http://exercism.io . I picked up the "Web Development with Clojure" book but it does not work for me. After looking at the https://www.youtube.com/watch?v=utmrSswhhn0&ab_channel=LosAngelesClojureUsersGroup video my takeaway was that Luminus has been more or less replaced by Kit. This was also mentioned here https://www.youtube.com/watch?v=DFzukK5-rpU&ab_channel=LondonClojurians . From the meetup video I had the impression that even experienced Clojure developers had a hard time to understand everything that was going on. I still don't know how I as a beginner should start approaching the web dev subject in the Clojure ecosystem.
I suggest you to start with a simple Ring + Jetty server (https://github.com/ring-clojure/ring) and learn about routing/ handlers, representation of request and response and middleware. Then you can switch to Compojure or add some Hiccup + Garden / Selmer. Then you can play with some database (don't connect it to your web, just download an example project (e.g. from HugSQL) and see how they represent data and SQL queries). After you learn these parts separately, web frameworks should make more sense to you.
Thank you for the advice! I will give it a try 😀
I have appreciated @U05254DQMs content here as a fairly no-nonsense introduction: https://practical.li
I also find the choices difficult to make. There are multiple Clojure sages who have made some form of tutorial or course on this topic, but they all tend to get out of date with current state of things quickly, and they all seem to differ in some significant ways (at least the differences seem significant to a beginner). Kit seems really nice since it already has plumbing in place for some things which otherwise take time to learn in isolation and then add to a project. Looking at a Kit-based project which has cljs, sql, and html modules included (all things you might want if making a modern web app), you see how complex the deps.edn looks. Cobbling something like that together as a beginner is unlikely.
Plus the added small issue of some tutorials being lein based while others are deps based.
This information overload is a problem. Learning the language and the tooling at the same time, is a challenge. Finding the proper starting point is not that trivial. I am optimistic that focusing on just one library at a time should do the trick 🙂. I just did not want to learn outdated stuff.
Although Clojure code should be the same regardless of if it's a Leiningen or deps.edn based tutorial, it does add more cognitive load to keep switching, especially when there are so many other things to learn. I don't know a way around this (without investing a few $100,000 on writing a long list of consistent tutorials) Unless a tutorial relies on a particular plugin to work, it should be possible to get the code working with either a project.clj or deps.edn file with the right dependencies (http://clojars.org can be used to translate between one format and another).
Luminus and Kit can create very big projects, so suggest limiting the options used when creating new projects. Essentially they do the same thing, although use different tools, libraries and configuration approaches. A simplistic difference is that kit takes a more data centric approach (hash-map and vectors for config, defining routes, etc) They do provide a lot of information and if you wanted to learn the entirety of one of these from scratch, I would set aside a 6 months timeline (unless you can devote yourself to full time study of it, then perhaps more like 3-8 weeks)
If anyone has any questions about any of the http://Practical.li content (or notices something missing - there is a lot to add), please do ask in #practicalli channel or send me a (polite/constructive) direct message
@U02AMR8032L This is why I created https://github.com/seancorfield/usermanager-example as a small, self-contained, database-backed web app (server-side) so that beginners could see how a small number of libraries could be combined to build basic HTML web apps -- and to be small enough that beginners could understand all the moving parts. The README links to another version built with different libraries -- again, small enough to understand the moving parts, and also to see how different libraries can be used to achieve similar ends.
That example originally use to support multiple HTTP servers but I cut that out as folks just found it confusing.
The reality is that Clojure is designed as a general purpose language to tackle "harder" problems than "basic web apps" -- so the benefits of using Clojure come in the larger, more complex systems and the flipside is that the small, simpler systems are not as well supported. By which I mean that you can definitely write small, simple systems in Clojure but you need to make a lot of decisions about the building blocks you want to use -- and that seems like a lot of work for a small, simple system (but it's much less work, relatively speaking, for a large, complex system).
I don't recommend Luminus (or Kit) for beginners, to be honest, because there are so many moving parts -- and if anything breaks, beginners are usually completely lost trying to figure it out.
Thank you very much for the repo and the advice. I would really like to have the possibility to tackle the harder and more complex problems in the future. I wanted to go the "basic web app" route because it would be something familiar and thus I hopped that it would be a good entry point. I am not so keen on frameworks but because I already had bought the book I wanted to give it a try 🙂.
Are you a web developer now, @U02AMR8032L? If so, what is your stack? If not, you have the added challenge of an unfamiliar domain added to unfamiliar language, IDE, and build tooling. Speaking of "unfamiliar language", have you worked through sth like Clojure Koans? http://clojurekoans.com/ Next issue is the Luminus/Kit thing. I am with Sean on this one, for the reasons he gave. It would be super if a framework Just Worked(tm) and gave you a big running start on web dev, but in fact they demand a big learning curve (of just that framework, no general skills) at the same time they are solving other problems for us. But those "other problems" are what we need to master, not have handed to us on a platter. I recommend first getting reasonably comfortable with Clojure while getting comfortable with an IDE at the same time, then grab one of several "hello world" projects, such as those offered by https://github.com/day8/re-frame. Here is one https://github.com/day8/re-frame-template. Also, build tools such as figwheel,main https://github.com/bhauman/figwheel-main offer ready-to-go repo/tutorials (look for "Try Figwheel with Flappy Bird"). One downside, though, is now having to learn re-frame 🙂 but the doc is great and re-frame seems to be the leading CLJS wev dev tool. If you like react, Helix has https://github.com/lilactown/helix. But then we need to know React. 🙂 If your skills already include React that would be great. In any case, by starting with a pre-built hello world, you can defer wrestling the CLJ tools madness until absolutely necessary. It is a CLJ problem worth avoiding. Btw, https://github.com/PEZ/rn-rf-shadow also offers great starter experiences but then we get into React Native and re-frame and the sad world of NPM. Again, let's defer that as long as possible. Once you find a "hello world" you like, just build out from there. hth
And it may not be obvious from Kenny's response there @U02AMR8032L but there's quite a bit of difference between frontend (ClojureScript) and backend (Clojure) in terms of code organization and tooling and so on. There are fewer differences between the two languages these days, fortunately. The two main options for cljs development are Figwheel Main and Shadow-cljs and there are dedicated channels for both here #figwheel-main #shadow-cljs (the latter is the far more popular approach but, like Kenny, I lean toward the former). re-frame is great (but, yes, there's a lot to learn there especially if you're not familiar with reactive approaches to UI development).