Skip to content

Instantly share code, notes, and snippets.

@ooooak

ooooak/To study

Created Feb 8, 2020
Embed
What would you like to do?
> https://www.reddit.com/r/Clojure/comments/f0b9bk/what_would_you_consider_to_be_the_hardest_thing/fgszcq0/
Learning the "vocabulary" ( partion-all, interpose, nthnext, nthrest, take-nth...)
def rabbits
[{:name "Fluffy" :color :white :size :large}
{:name "Chocolate" :color :brown :size :medium}
{:name "Hopkins" :color :black :size :medium}])
(def get-medium-bunny-names ; defines a transformation on a process
(comp
(filter #(= (:size %) :medium)) ; note the arity of these two
(map :name)))
(into [] get-medium-bunny-names rabbits) ; produces ["Chocolate" "Hopkins"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment