Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

And the libraries are full of side effects.


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_Jav...).


Why are you so fixated on lists? There is more to functional programming than that.


Lists are a major part of functional programming, you could use arraylists and just make a new one every time you need to "change" data, but they're essentially lists (just not as clear).


Breathing is a major part of living, too. Java can do linked lists, yes.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: