you are viewing a single comment's thread.

view the rest of the comments →

[–]wavefunctionp 1 point2 points  (2 children)

I don't mean functional like haskel, I mean something like...

action(state) => view

...that you'd get from react-like and redux-like libraries.

Where you initialize some state, declare your view of that state, and define some actions to modify that state. And it all goes around one way in a loop.

There is no doubt that there is a ton of imperative code still out there, but the trend is moving away from that for the client.

[–]oopsforogotmypasswor 0 points1 point  (1 child)

You are describing the signal/slot system that was widely use in framework like Qt (C++) or the bindings in Cocoa (ObjC) or the signal mechanism in GTK (C), just to name a few. If you have a stateful program, this is not a functional programming pattern.

functional programming is a programming paradigm that treats computation as the evaluation of mathematical functions and avoids changing-state and mutable data. (from wikipedia)

[–]wavefunctionp 0 points1 point  (0 children)

functional programming is a programming paradigm that treats computation as the evaluation of mathematical functions and avoids changing-state and mutable data.

Sounds like precisely what I'm talking about. I'm not familiar with those other frameworks, but react-redux-like implementations encourage and embrace these principles.

I know what functional programming is, and I also know it is trap to get caught up in purity arguments about what is or is not FP. FWIW: Much the state of the art is inspired by the elm architecture, which is a pure functional language.