Skip to content

Latest commit

 

History

History
55 lines (28 loc) · 855 Bytes

Reducers.md

File metadata and controls

55 lines (28 loc) · 855 Bytes

Reducers

Reducers patterns (explained with guys and cats).

Map

[😁 😂 😃] => [😸 😹 😺]

Filter

[😁 😂 😹 😃 😸] => [😹 😸]

Remove

[😁 😂 😹 😃 😸] => [😁 😂 😃]

Keep

[😁 😂 😹 😃 😸] => [😁 😂 😃]

Take

[😁 😂 😹 😃 😸] => [😁 😂 😹]

Drop

[😁 😂 😹 😃 😸] => [😹 😃 😸]

Partition

[😁 😹 😃 😸] => [[😁 😹] [😃 😸]]

Merge

[😁 😹] [😃 😸] => [😁 😹 😃 😸]

Flatten

[[😁 😹] [😃 😸]] => [😁 😹 😃 😸]

Mapcat

[😃 😣] => ([[😸 😺] [😿 🙀]]) => [😸 😺 😿 🙀]

Distinct

[😌 😍 😏 😌 😍] => [😌 😍 😏]

Dedupe

[😌 😍 😍 😏 😌] => [😌 😍 😏 😌]

Sort

[😁 😂 😔 😞 😪] => [😪 😞 😔 😁 😂]