|
@Conaw | |||||
|
Reduce. Filter. Map.
I first learned to code for the same reason I learned foreign languages. I was promised it would change the way I think.
Those three functions for transforming lists delivered so thoroughly it's hard to think without them.
Algorithms of thought.
|
||||||
|
||||||
|
Conor White-Sullivan🧢
@Conaw
|
30. svi |
|
Reduce:
Take a list, an accumulator, and a function that looks at each item in the list one at a time, and the current value of the accumulator, and transforms the accumulator to pass on to the next value in the list.
Can produce a new list, or just find a single value
|
||
|
|
||
|
Conor White-Sullivan🧢
@Conaw
|
30. svi |
|
Map and Filter are both built out of reduce
|
||
|
|
||
|
Conor White-Sullivan🧢
@Conaw
|
30. svi |
|
Filter -- take a list, and a test, return only the items of the list that meet the test criteria
|
||
|
|
||
|
Conor White-Sullivan🧢
@Conaw
|
30. svi |
|
Map -- take a list, and a transformation function, return a new list
|
||
|
|
||
|
Conor White-Sullivan🧢
@Conaw
|
30. svi |
|
In practice -- for notes
Filter your notes for questions
Map over your open questions and say
-- how could I reframe this question to make it easier to answer
-- what smaller or bigger questions help me answer this one
-- how will I know I've found an answer
|
||
|
|
||
|
Conor White-Sullivan🧢
@Conaw
|
30. svi |
|
Filter your notes for beliefs
Map over them
Ask
-- How surprised would I be if this were false ("weight")
-- what other beliefs do I think are true because this one is *what does this imply*
-- What other beliefs, if I changed my mind about them, would change this one
|
||
|
|
||
|
Conor White-Sullivan🧢
@Conaw
|
30. svi |
|
Even computer threads look at items in a list one at a time. They just do it quickly.
No shame in doing the same
|
||
|
|
||
|
Gordon Brander
@gordonbrander
|
15. pro |
|
Understanding Hickey's reducers/transducers was a transcendental moment for me. Flipped my thinking inside-out.
|
||
|
|
||
|
Alper Çuğun-Gscheidel 📖☕️🇪🇺🌹🌻
@alper
|
15. pro |
|
What do you reckon about fmap and bind and the likes?
|
||
|
|
||