Fork me on GitHub

@polymeris: Clojure Applied talks a lot about defining your own constructors that call ->Thing and this post also encourages the same:


Also, Stuart points out in follow up on that post that mucking with ->Thing itself would be relying on implementation details.


Thanks, @mfikes, for the pointer. Guess I'll just use thing as my constructor.


what are the best resources for web development in clojure


@lewix: The Luminus framework ( and the book by his author Web Development in Clojure ( are great places to start


@val_waeselynck: I'm surprised that's the only book about web development out there


@lewix: that's because there's not much to web development in Clojure. I think many web frameworks in other languages need to make up for deficiencies in the language's standard library and features set. Because Clojure is data-oriented, has declarative syntax, and good constructs for declaring / communicating between components, web concepts translate naturally into the language without much need for new technology.


Basically, web development in Clojure is an HTTP-mapping layer + app development in Clojure


val_waeselynck: just looking for a screencast from A to Z about web development in clojure is not a walk in the park as opposed to rails/node.js/django/C#...


val_waeselynck: What you say may be true but I believe that the community doesn't invest as much in learning ressources


@lewix: I agree about learning resources. Also, because of the emphasis of the community on simplicity over ease, you will tend not to find many out-of-the-box solutions. AFAICT people tend to choose Clojure to optimize their asymptotic speed, oftentimes at the expense of their startup speed.


Having said that:


1) lein new luminus <myapp> is quite a good quickstart


2) Don't forget you have a REPL! You can learn very fast thanks to interactive programming.


Yeah, the main thing I wanted with web apps in Clojure was the ability to have convention-based controller namespaces found and loaded, rather than declarative routes. So I ported the lightweight MVC framework I wrote in 2009 from another language to Clojure, and that’s what we use at work for some of our stuff.


It’s basically Ring / Jetty / Selmer / Cheshire and my dynamic routes-to-namespaces logic.


They way I usually learn is a mix of both reading , looking at screencast , and doing. Clojure/clojurescript has some books, not enough good and long enough screencast to refer to. It adds to the learning curve to always wonder if you're doing things right, and you can't refer to best practices. (my two cents)


The CFML version is one of the two most popular MVC frameworks used in CFML.


I’ll be interested to see what Arachne brings to the table but it sounds like it’s going to be so modular and general purpose (and data-configuration-driven) that I have a hard time believing it will be truly simple.


@seancorfield: yeah seems to me it's the Pedestal story repeating itself


(supported it all the same, I'd love to see a solution for web development that's both robust and accessible)


@lewix: I agree with you on the lack of screencasts (although I personally don’t like them, I know many people find them one of the best ways to learn "how to").


@val_waeselynck: Oh, totally, yes, having a great web framework that’s easy for new folks to stand up decent-sized apps will be a big boost for Clojure. But I’m no fan of Rails / Grails (or ColdBox in CFML) or any of the "big" frameworks.


People learn differently @seancorfield. i found screencast a way to speed up my learning experience or get it started. Books usually reinforce it, and take me to the next level


@seancorfield: I think there a fundamental opposition between simplicity and accessibility so I'm not too optimistic... But I have known Clojure to break such kind of tradeoffs 🙂 so looking forward to what's gonna come out.


In rails/django there's a bunch of course where you see an app being built from A to Z. I wish clojure had more of those


I'm not talking about 10min videos . I'm talking about 7-10hours courses


Also, It doesn't have to be a framework.


@lewix oh I see. Interesting. I never use that kind of resource indeed.


@lewix: I also think that in the Clojure web community, a lot of the attention is focused on very cutting-edge paradigms like Om/Next etc. Definitely too early stage for that kind of resource.


I guess but won't it always make clojure a language for other languages to get inspiration from rather than a to go to language?


I don’t think so. And I mean that I don’t think Clojure’s popularity will be predicated on the presence of in-depth screencasts. Clojure’s still young, all things considered, and tends to demote all-encompassing frameworks so no one really wants to create a 7-10 hour screencast for a framework or paradigm that might six months down the road be relegated.


akiva: I was referring to the fact that clojure focus is geared towards cutting/edge. Javascript probably move faster than clojure yet the learning resources are abundant - I don't think that's an excuse


Also, people won't adopt Clojure because it's comfortable for web development, for which there are established (and quite good) alternatives. I believe language becomes mainstream when it's the first to solve a problem that's becoming popular, and classical Rails-like web development isn't a good candidate problem IMHO. Sophisticated single-page-app development might be.


If I were to plan Clojure's strategy for taking over the world (which I'm not), I'd be looking for such a new problem domain.


@lewix: in any case it's a good thing of you to report this kind of difficulty.


JavaScript is older and more widely used, @lewix, and there are plenty of accepted paradigms already in place. Remember, Clojure is still a 1.x language. ClojureScript is even younger. Also, Clojure presents a programming paradigm that is foreign for many and difficult to adapt to for others whereas JavaScript, although technically prototypical, can be fully coded in a familiar way to OO. I agree with @val_waeselynck that simply resolving what’s already solved by other languages isn’t Clojure’s way ‘in’ so to speak.


akiva: ok. what about elixir then, go ahead and google elixir screencast or learning materials.


Clojure isn’t Elixir. Maybe their community is different. Just because language A is supported in a certain way that is amenable to you doesn’t mean language B must follow suit. Clojure promotes learning-by-doing which is why we have the Koans and whatnot. There are tons of learning materials for Clojure such as Clojure for the Brave and True and Living Clojure. Maybe Clojure people prefer to read than they do watch screencasts.


I think that you miss the point. As I stated above I do both, and for your information I read both brave and true and living clojure.


Maybe you should restate your point.


I know a losing battle when I see one. I'll step back


@lewix again, I'm not sure I can tell what you're looking for, but it seems to me that there are screencasts on youtube


I don’t see a battle but okay.


There's also video courses from Eric Normand


val_waeselynck: I subscribed and watched 90% of it


val_waeselynck: there's also lambda island


@lewix by the way, I was thinking of learning a bit of Django one of these days, do you have such a screencast to recommend ?


I watched a bit of which I thought was quite good although probably too fast for someone new to Clojure.


val_waeselynck: I did more rails than django a long time ago. However, I heard that is good


I find it interesting that the "state of the union" survey for Clojure has shown web development as the number one thing people do with the language . . . and yet there are still so few resources on "best practice" for web development and no "mainstream" ways to build web apps, beyond assembling a collection of your "favorite" libraries.


And there are certainly a myriad ways to assemble libraries and build web apps with Clojure!


@seancorfield: we chose Clojure and Datomic for my startup because we needed the 'superpowers' that go with it, the things these technologies let you do that have no equivalent in mainstream languages... we're still pioneering here, so i guess it's no wonder the best practices aren't established yet


Is there a more concise way to remove one level of structure than (mapcat identity coll)?


ah, sweet; ty


Also cat if you're using it in a transducer


can something like (juxt (take-nth 2) (comp (drop 1) (take-nth 2))) be sensibly wielded? Or do I need to use partial on the inner arguments to prevent them from becoming transducers for this to work?


The goal: split an collection into two sub-collections with alternating elements. I've already solved it using partition 2 and then transposing, but I thought juxt would be a more elegant and clear way to express things


     (partial take-nth 2) 
     (comp (partial take-nth 2) (partial drop 1)))
Is working for now, but, all the partials hurt my soul


@montanonic: The only simplifications coming to mind are anonymous function literals (in lieu of partial), and rest:

(juxt #(take-nth 2 %) (comp #(take-nth 2 %) rest))


Is there any style-consensus on using anonymous literals vs partial?


Being used to currying, partial just seems much too long a name for such a common thing to do, especially in an otherwise succinct language.


If I had to guess, anonymous function literals appear to be more popular.


good to know; thank you


As an advocate of piping, I changed it further to

     #(take-nth 2 %)
     #(->> % rest (take-nth 2)))