This repository holds the code for Funktools
that implements the fold
function.
fold
is a higher order function that takes
- a sequence of type A
- a "starting" value of type B
- a function (A, B) -> B
and returns a B. E.g., the sum
of an array is a special case of fold, where
- the sequence is an array of numbers
- the starting value is 0
- the function is
+
You can find more information on Wikipedia.
│ INSTRUCTIONS.md | Given Instructions
│ README.md
│ requirements.txt | Dependencies
├───html | PyDoc Documentation
│ examples.html
│ funktools.html
├───src
│ │── examples.py | Examples of using fold
│ │── funktools.py | Implementation of fold
│ │── __init__.py
└───tests
│ test_funktools.py | Unit tests
- Implement barebones fold to replicate
reduce
function fromfunctools
- Add test-cases to verify parity with
reduce
- Add fold-right & fold-left operations.
- Add debug feature, print status on each iteration
- Test other fold examples, like doing map or filters
- No parallelism. Accumulator functions that are associative could be parallelized, but it is beyond the scope.
- TODO - Add examples for these (maybe not the last)