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"
|
"You can also group by a primary key"
|
||||||
(= __
|
(= __
|
||||||
(group-by :id [{:id 1 :name "Bob"}
|
(group-by :id [{:id 1 :name "Bob"}
|
||||||
{:id 2 :name "Mike"}
|
{:id 2 :name "Jennifer"}
|
||||||
{:id 1 :last-name "Smith"} ]))
|
{:id 1 :last-name "Smith"} ]))
|
||||||
|
|
||||||
"But be careful when you group by non-required key"
|
"But be careful when you group by non-required key"
|
||||||
(= {"Bob" [{:name "Bob" :id 1}]
|
(= {"Bob" [{:name "Bob" :id 1}]
|
||||||
"Mike" [{:name "Mike" :id 2}]
|
"Jennifer" [{:name "Jennifer" :id 2}]
|
||||||
__ [{:last-name "Smith" :id 1}]}
|
__ [{:last-name "Smith" :id 1}]}
|
||||||
(group-by :name [{:id 1 :name "Bob"}
|
(group-by :name [{:id 1 :name "Bob"}
|
||||||
{:id 2 :name "Mike"}
|
{:id 2 :name "Jennifer"}
|
||||||
{:id 1 :last-name "Smith"}]))
|
{:id 1 :last-name "Smith"}]))
|
||||||
|
|
||||||
"The true power of group-by comes with custom functions"
|
"The true power of group-by comes with custom functions"
|
||||||
(= __
|
(= __
|
||||||
(group-by #(if (:bad %) :naughty-list :nice-list)
|
(group-by #(if (:bad %) :naughty-list :nice-list)
|
||||||
[{:name "Jimmy" :bad true}
|
[{:name "Jimmy" :bad true}
|
||||||
{:name "Jack" :bad false}
|
{:name "Anna" :bad false}
|
||||||
{:name "Joe" :bad true}])))
|
{:name "Joe" :bad true}])))
|
||||||
|
Loading…
Reference in New Issue
Block a user