How can you do anything useful without mutable state?

I’ve been reading a lot of stuff about functional programming lately, and I can understand most of it, but the one thing I just can’t wrap my head around is stateless coding. It seems to me that simplifying programming by removing mutable state is like “simplifying” a car by removing the dashboard: the finished product … Read more

Abusing the algebra of algebraic data types – why does this work?

The ‘algebraic’ expression for algebraic data types looks very suggestive to someone with a background in mathematics. Let me try to explain what I mean. Having defined the basic types Product • Union + Singleton X Unit 1 and using the shorthand X² for X•X and 2X for X+X et cetera, we can then define … Read more

Why isn’t Python very good for functional programming? [closed]

Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 3 years ago. Improve this question I have always thought that functional programming can be done in Python. Thus, I was surprised … Read more

Functional style of Java 8’s Optional.ifPresent and if-not-Present?

In Java 8, I want to do something to an Optional object if it is present, and do another thing if it is not present. if (opt.isPresent()) { System.out.println(“found”); } else { System.out.println(“Not found”); } This is not a ‘functional style’, though. Optional has an ifPresent() method, but I am unable to chain an orElse() … Read more

Why functional languages? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 8 years ago. Improve this question I see a lot of talk on here about functional languages and stuff. Why would … Read more

What does “coalgebra” mean in the context of programming?

I have heard the term “coalgebras” several times in functional programming and PLT circles, especially when the discussion is about objects, comonads, lenses, and such. Googling this term gives pages that give mathematical description of these structures which is pretty much incomprehensible to me. Can anyone please explain what coalgebras mean in the context of … Read more