Skip to content

Instantly share code, notes, and snippets.

@ooooak
Created February 8, 2020 05:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ooooak/d889cebd1d4a42fd92c92ac42d1b285c to your computer and use it in GitHub Desktop.
Save ooooak/d889cebd1d4a42fd92c92ac42d1b285c to your computer and use it in GitHub Desktop.
> 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