Please note that the brevity of my example relies upon a strong type system with at least basic generics support.
Interesting google terms:
Discriminated Unions
Functional programming
Monads
Haskell (or Hindley-Milner type systems)
Lodash (decent javascript functional library, though this may be a little opaque unless you experiment with a FP language for a while)
And now with monads....
Please note that this example is bad because it appears to rely on side effects
I have googling to do it seems
Please note that the brevity of my example relies upon a strong type system with at least basic generics support.
Interesting google terms:
Discriminated Unions
Functional programming
Monads
Haskell (or Hindley-Milner type systems)
Lodash (decent javascript functional library, though this may be a little opaque unless you experiment with a FP language for a while)
Thank you for this. I'll add it to this weekends reading list.