Created
February 8, 2020 05:18
-
-
Save ooooak/d889cebd1d4a42fd92c92ac42d1b285c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> 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