This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-07-11
Channels
- # announcements (6)
- # architecture (14)
- # babashka (26)
- # beginners (22)
- # calva (11)
- # clj-kondo (2)
- # clj-on-windows (1)
- # cljsrn (10)
- # clojure (116)
- # clojure-europe (5)
- # clojure-uk (1)
- # clojurescript (5)
- # cursive (9)
- # datomic (21)
- # depstar (1)
- # events (1)
- # fulcro (2)
- # graalvm (17)
- # graalvm-mobile (28)
- # helix (3)
- # introduce-yourself (2)
- # jobs (2)
- # lsp (4)
- # meander (1)
- # off-topic (4)
- # pathom (5)
- # polylith (6)
- # practicalli (5)
- # reagent (67)
- # reitit (1)
- # releases (2)
- # shadow-cljs (24)
- # tools-deps (23)
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 - https://4clojure.oxal.org/
I've also added a link to re-find website to https://practical.li/#resources 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 - https://practical.li/practicalli-landing-page/#books 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 https://clojuredocs.org/clojure.core/for#example-60eb570de4b0b1e3652d7516I've updated the Practicalli landing page with the new book layout. Hopefully this is clearer as to each books intent. https://practical.li/