QuoteOriginally posted by: VivienBQuoteOriginally posted by: chocolatemoney"Monads look like a patch to allow mutability in pure FP."Monads are much more than that.You might be right, I'm not that much familiar with monads.QuoteOriginally posted by: chocolatemoney.. If a PDE solves for the evolution of a system in time, then at some point, the PDE solver will inevitably need to deal with state (as opposed to a functional stateless implementation) Hence, one more reason to use monads and monadic functions (well, unless you just want to give up and go imperative)I don't see where you need states. I think PDE can be implemented in a pure functional style without using monad (or imperative prog).Btw, yes, in some case, I prefer to give up and go imperative. IMHO, whatever the paradigm, it is not a good idea to follow only this paradigm.I see monads (computational expressions) as data/worflow computational engines like a pipeline. But AFAIK this is generated data that is thrown away at some stage. Not every app is a pipeline.But there are other data types (e.g. a complex lattice model with complex node data and structure) and we want to have functions operating on it for ctor, forward+ backward induction, discrete div, early exercise etc. Then the functional model is perfect IMO (e.g. in C++ use std::function and std::bind for existing OO member functions and this works) and I reckon it will work for F# as well. Since it is syntax-based interface we can use the same data + algos for lattice interpolation models in numerical analysis.I think a two-layer model is good:1. Data (OOP + structs)2. Function (FP aproach + all that fold stuff) operating (read and write) on the data in level 1. You can use OOP for this layer using subtype polymorphism but explosion in the number of classes... Tuples are also very useful; how did we live without them in C++ for the last 25 years?Neither a pure OOP nor pure FP be? Gut feeling is pure FP is not the way to go.// Inside STL there's a wee FP model trying to escape (map and reduce).//Monads feel not even wrong. Category theory for FP
Last edited by Cuchulainn
on May 26th, 2013, 10:00 pm, edited 1 time in total.