Fork me on GitHub

I've started working on a lot of updates and additions to the Practicalli content and there is a huge amount to do. I'm updating the links and content around 4Clojure, as its now been replaced by 4ever-clojure -


I've also added a link to re-find website to as its a great tool to help you find Clojure functions based on the shape of arguments and return values.


I am starting to re-design the layout of the main Practicalli web page, to make it easier to understand all the books I am working on - I have updated the alpha stage books, which seems nicer. I also tweaked some of the graphics. I'm tweaking the code to use generator functions to create all the hiccup code, rather than have it all done my hand. I find it easier to write hiccup code first and then write a generator function after. I'll add more details of building these sorts of ClojureScript / Reagent landing pages to the Practicalli Clojure book soon (there are a couple of examples there already)


I have been using the for form to refactor the Practicalli landing page hiccup code, so repetitive code is generated. For example, to generate the list of books, I define the specific book details in a collection of hash-maps and pass that to a function that generates the hiccup for each book in the collection. Then each book is pulled from the collection as a local name, i.e. book

(for [book books]
  ;; hiccup template code
  (get book :url) 
To avoid multiple get calls, or threading the hash-map through the key, I wanted to do some destructuring of each hash-map in the for. {keys [title description url image]} will destructure each book in the collection of books The for takes a :let directive, although it seems that does not work with this type of desctructuring However, destructuring in the sequence expressions does work
(for [{keys [title description url image]} books])
I didnt see kind of example on clojuredocs, so I added one here


I've updated the Practicalli landing page with the new book layout. Hopefully this is clearer as to each books intent.

🎉 7
👍 12