Created
August 29, 2016 02:25
-
-
Save jdmorlan/2d19e7a3173dea84c0e5b9ed8073b0bc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Initial State | |
{ | |
status: 'pending', | |
initial: null, | |
items: [], | |
reducer: null, | |
iterations: [] | |
} | |
// Set Initial Value | |
{ | |
status: 'pending', | |
initial: 0, | |
items: [], | |
reducer: null, | |
iterations: [] | |
} | |
// Set Items | |
{ | |
status: 'pending', | |
initial: 0, | |
items: [1,2,3,4], | |
reducer: null, | |
iterations: [] | |
} | |
// Set Reducer | |
{ | |
status: 'pending', | |
initial: 0, | |
items: [1,2,3,4], | |
reducer: (accumulator, current) => accumulator + current, | |
iterations: [] | |
} | |
// Evaluate Reducer (First Pass) | |
{ | |
status: 'reducing', | |
initial: 0, | |
items: [2,3,4], | |
reducer: (accumulator, current) => accumulator + current, | |
iterations: [ | |
{ accumulator: 0, current: 1, returns: 1 } | |
] | |
} | |
// Evaluate Reducer (Second Pass) | |
{ | |
status: 'reducing', | |
initial: 0, | |
items: [3,4], | |
reducer: (accumulator, current) => accumulator + current, | |
iterations: [ | |
{ accumulator: 0, current: 1, returns: 1 }, | |
{ accumulator: 1, current: 2, returns: 3 } | |
] | |
} | |
// Evaluate Reducer (Third Pass) | |
{ | |
status: 'reducing', | |
initial: 0, | |
items: [4], | |
reducer: (accumulator, current) => accumulator + current, | |
iterations: [ | |
{ accumulator: 0, current: 1, returns: 1 }, | |
{ accumulator: 1, current: 2, returns: 3 }, | |
{ accumulator: 3, current: 3, returns: 6 } | |
] | |
} | |
// Evaluate Reducer (Fourth Pass) | |
{ | |
status: 'completed', | |
initial: 0, | |
items: [], | |
reducer: (accumulator, current) => accumulator + current, | |
iterations: [ | |
{ accumulator: 0, current: 1, returns: 1 }, | |
{ accumulator: 1, current: 2, returns: 3 }, | |
{ accumulator: 3, current: 3, returns: 6 }, | |
{ accumulator: 6, current: 4, returns: 10 } | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment