4 ms·
Who needs libraries for non-destructive programming in java? You can just use an interface for a list of T (ILoT), a representation of an empty list (MtLoT), a
by speek 18y ago
Who needs libraries for non-destructive programming in java?
You can just use an interface for a list of T (ILoT), a representation of an empty list (MtLoT), and a ConsLoT which has a first (which is of the type T) and a rest (which is of the type ILoT).
Bam, you've got a list implementation ( new ConsLoT(new T(arg1, arg2, argN), new ConsLoT(new T(argA, argB, argN), new MtLoT)); ).
Function objects are a little different though (http://en.wikipedia.org/wiki/Function_object#Functors_in_Java http://en.wikipedia.org/wiki/Function_object#Functors_in_Jav...).
- eru 18y agoWhy are you so fixated on lists? There is more to functional programming than that.