-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
We're still working with reduce as the basis for recursive list computation.
exercise 3
Implement myFilter this time. Once again using only a single call to myReduce.
exercise 4
Now do myGroupBy. You're still only allowed to implement it using a single call to myReduce. The function should accept a collection and a function. All items in the collection should be grouped by their return value for that function. The return type should be an object / associative list / hashmap / whatever you want to call it. For example:
myGroupBy([1,2,3,4,5,6], (item) => {
return ( item & 1 ) ? "odd" : "even";
})
should return
{
"odd": [1,3,5],
"even": [2,4,6]
}
Metadata
Metadata
Assignees
Labels
No labels