A variety of functional programming examples in TypeScript.
See Index.ts for contents.
- Map & Reduce
- Data Structures & recursion: Stack & Tree
- Lazy evaluation, Stream
- Monads
- A simplified implementation of JS Promises. [MyPromise.ts]
- A
Promise.all
implementation that uses advanced TS type inference. [MyPromiseAll.ts]
- A FP Parser Combinator where parser functions can be combined like regex. [ParserCombinator.ts]
- A tokenizer for math formulas using the Parser Combinator, to split
"(123+45)*6"
into "tokens" such as["(", "123", "+", "45"...]
. [Tokenizer.ts] - A math formula evaluator that evaluates the tokens from the Tokenizer into a numeric result. e.g. "(123+45)*6" becomes the number 1008.[EvaluatorTests.ts]
- TS Basics: Arrays, objects, types, keyof, instanceof
- Method overloading with types
- Ways to infer types