attempt to make koans more inclusive
This commit is contained in:
parent
c4958a9263
commit
6d5b226307
@ -19,20 +19,20 @@
|
||||
"You can also group by a primary key"
|
||||
(= __
|
||||
(group-by :id [{:id 1 :name "Bob"}
|
||||
{:id 2 :name "Mike"}
|
||||
{:id 2 :name "Jennifer"}
|
||||
{:id 1 :last-name "Smith"} ]))
|
||||
|
||||
"But be careful when you group by non-required key"
|
||||
(= {"Bob" [{:name "Bob" :id 1}]
|
||||
"Mike" [{:name "Mike" :id 2}]
|
||||
"Jennifer" [{:name "Jennifer" :id 2}]
|
||||
__ [{:last-name "Smith" :id 1}]}
|
||||
(group-by :name [{:id 1 :name "Bob"}
|
||||
{:id 2 :name "Mike"}
|
||||
{:id 2 :name "Jennifer"}
|
||||
{:id 1 :last-name "Smith"}]))
|
||||
|
||||
"The true power of group-by comes with custom functions"
|
||||
(= __
|
||||
(group-by #(if (:bad %) :naughty-list :nice-list)
|
||||
[{:name "Jimmy" :bad true}
|
||||
{:name "Jack" :bad false}
|
||||
{:name "Anna" :bad false}
|
||||
{:name "Joe" :bad true}])))
|
||||
|
Loading…
Reference in New Issue
Block a user