Fork me on GitHub
Josh Horwitz00:02:39

What is the best book recommendation following Clojure For the Brave and True, which I already have


@joshua.d.horwitz: I think Clojure Applied ( ) is really good as a second book. I also really enjoyed Web Development with Clojure (2nd edition now in beta and seems good so far and Clojure Reactive Programming ( ) if either of those subjects are interesting to you. Pretty much all the Clojure books are available on on Safari books, which has a 30 day trial, so it's pretty easy to get access for a month and see which ones really resonate with you (or get a subscription longer if the rest of the service seems worthwhile). Pragmatic seems to put out really good Clojure books, Packtpub is pretty mixed in quality from what I've seen, and O'Reilly and Manning have some good books that are a bit older. Brian Marick also has a good book on Leanpub if you are coming from the OO world ( ).


@joshua.d.horwitz: I think Joy of Clojure is a pretty unbeatable second book (although I haven't read Clojure Applied yet, and it sounds great).


It’s not commonly recommended, but nothing really clicked for me like Brian Marick’s Functional Programming for the Object-Oriented Programmer


Can I ask a stupid noob question about Java interop? One of the very first examples in Programming Clojure is this function: (defn blank? [s] (every? #(Character/isWhitespace %) s)) Looking at it, I instantly wonder: why is Character/isWhitespace wrapped in an anonymous function? A Java method is basically the same thing as a function, right? (This may clue you in to the obvious: I don't actually know Java.) And single-arity functions don't need to be wrapped in other anonymous functions to serve as an argument to every? ---like, this works fine: (defn alleven? [v] (every? even? v)) So the following should work: (defn blank? [s] (every? Character/isWhitespace s)) But, instead, when I try that in a REPL it throws a mysterious error: CompilerException java.lang.RuntimeException: Unable to find static field: isWhitespace in class java.lang.Character, compiling:(NO_SOURCE_PATH:1:18) If I had any idea what a "static field" was, I'd probably be able to understand the mystery here. But, as noted, I don't know Java. I know Python, and JavaScript (ish) and a bit of C, but, well... Is the general principle that you have to wrap Java stuff in anonymous functions? Thanks!


hey @gowder- that's a good example. It's confusing in the sense that if Character referred to a Clojure namespace in which lived a single arity function called isWhitespace, your second example would work fine. But Character refers to a Java class so the implications of the same syntax are a little different, as described: In the (every? Character/isWhitespace ...) form, Character/isWhitespace is not in function position, so Clojure treats it as a "static field"- roughly equivalent to a class variable in Python, a value slot associated with the class, rather than with an instance. But it's not a static field, so when examining the Character class, Clojure can't find it. In the (every? #(Character/isWhitespace ...)) form, Character/isWhitespace is in function position, so Clojure treats it as a "static method"- a function associated with the class, rather than an instance- and that is what it is, so Clojure is able to find it when examining the Character class.


Anyway- you do have to wrap or otherwise adapt Java incantations for use in a Clojure function context.


Hi everyone. I am literally just starting my journey into the land of Clojure. I was curious as to how html is used within Clojure for web app development. Are .html files included inside projects or is everything down with a templating engine similar to this article (


I tried using Luminus to generate their example app and this appears to have a /resources/templates/ folder with html files in


Is the inclusion of these template html files within Luminus something that Luminus itself makes possible or is this functionality built-in to Clojure?


No, clojure does not include any „templating“. IIRC then luminus uses the Selmer library to do html based templating:


But it supports some other templating libraries too, so take this as an educated guess for your particular case.


Any recommendations for books for a Clojure noob coming from a specifically web-oriented background? Clojure Web Development Essentials, Web Development with Clojure (2nd Ed.), etc.?


@yogidevbear: try the official documentation of luminuweb,its a nice framework too


Thanks Sam, I was looking through that earlier this morning. Seems very cool. I suppose I'm really trying to wrap my head around the differences between what is Clojure specific and what is 3rd party developed library/framework stuff in the context of web app dev.


So far though, I'm really liking what I see overall


@yogidevbear: from my point of view libraries /framework are to make your work easier in accomplishing some tasks in clojure and also make development much faster. its an intresting framework,learning to use it too


I'm all for frameworks that make work easier/faster simple_smile I suppose the main difference is that frameworks come and go whereas the core language features are likely to persist for longer, so striking a good balance between understanding the core language and using the most appropriate framework is important. And because I'm completely new to Clojure, I guess I'm just trying to figure out what the best approach or framework is to use that will give me the most mileage and keep me heading in the right direction.


Luminus does seem pretty awesome


And the docs seems pretty well put together


you are so right,understanding the core language is quit important and it even makes it easier understanding how to work with a http://framework.Am also learning clojure though quit held up by work stuff,and as for luminusweb its great.


and its better to learn with a project in hand for good practice.😀👍


@yogidevbear: you use other languages too?


Yes, coming from a ColdFusion background at the moment. Before that I did .NET (back in the days of webforms - shudder)


thats cool,coldfusion i have not used it before


I really like it. I think it gets a lot of flack from the newer "cool kids", but truthfully I quite enjoy coding with it.


haha.the cool kids are quit a number and seem to be taking over in web development


So do you use any other languages? Maybe move discussion to #C03RZGPG3 ?


@yogidevbear: if you’re new to clojure, I would recommend taking a couple of days learning some clojure before getting into the web development. This course is good, starting from the basics.


If I use (java.util.Date.), I get a java.util.Date object which looks like #inst "2016-02-17T20:28:02.815-00:00". I just want the date part as a string, but take doesn't work on that object and str changes the formatting completely. How do I just get the date?


I see mentions of packages like clj-time online but that seems like overkill to just get the date.

Chris O’Donnell20:02:08

@arijun: if you don't want to use clj-time, I think you could cobble together a solution using java.util.Calendar.

Chris O’Donnell20:02:05

clj-time is really simple, though. I'd probably use that if it were me.


Another option is, and especially if the library is well-designed, to simply take the functions you need and incorporate them directly. Most libraries have generous licenses; just make sure you credit the original authors in the comments and so forth as required.


Cool, thanks @ghufran. I'll check the link out


@akiva: not sure that would work in this case since it looks like clj-time is built on top of a java library (joda).


@codonnell: perhaps you're right, might as well just grab clj-time.


Ah, yeah, @arijun, that’s true. But it might be worth a look.