3 ms·
> and yet there still don't seem to be many non-trivial apps written in any of these languages Perhaps you are not looking hard enough? Sure, if your problem s
by outworlder 12y ago
> and yet there still don't seem to be many non-trivial apps written in any of these languages
Perhaps you are not looking hard enough? Sure, if your problem space is CRUD web apps, then you won't find many implementations. Try looking into more difficult problem spaces, such as high-frequency trading, and you'll suddenly find more FP examples.
Also, there's Erlang, which was developed by Ericsson to solve a very specific, real-world problem. Look it up.
- bane 12y agoTo be honest, I'd be happy with a 1 level interactive demo (with sound) of a Mario Brothers style platform game.
- kasey_junk 12y agoThat is sort of the worst case scenario for a FP program (though I'm sure you could write it in FP). It is almost entirely side-effects. I agree with the sentiment that for a paradigm that has been advocated for 60 years it is really odd how little non-academia code is written in it. In my experience you find functional code shines (and is therefore common) in places where prove-ability is of the utmost importance or where writing custom DSLs provide a lot of value. Things like nuclear systems, extremely high security applications (think custom OS level requirements) or financial modelling software. That said in most of the places I've found the FP program is a high value prototype or proof of concept, not the actual system. I don't know if that is just a resource allocation thing or not.
- seanmcdirmid 12y agoThere are plenty of side effect free ways of dealing with change...you can make the effects you know...explicit. Anyways, for a game like SMB, FRP should work relatively well. Just be careful with collections.
- kasey_junk 12y agoBut there are no side effect free ways of changing the pixels on a screen or the sounds coming out of a speaker as those are precisely side effects. Of course there are ways of abstracting those side effects and acting like they are the same as pure functions. Or conversely instead of hiding them, you could point them out and make them "exceptional", which is what I assume you mean by making them explicit. These machinations (of which FRP is a clear example) to deal with side effects have a price, and in a game like SMB it is entirely possible that the vast majority of the work would be this overhead. Again, of course you can do it, but it is a problem domain not particularly suited to FP in and of itself. I've written short running, fast starting, memory constrained applications in Java, but it was a fight to do it. If the fight is worth the other advantages, it can be worth it.
- dllthomas 12y ago"But there are no side effect free ways of changing the pixels on a screen or the sounds coming out of a speaker as those are precisely side effects." No, those are precisely effects. They can only be side effects once you've defined how you're distinguishing side effects from effects generally. A common way is labeling intended results "effects" and unintended results "side effects". By this definition, they're clearly effects not side effects, though this equally clearly isn't the usage in question. Another way - common in Haskell - is to label effects that do not appear in a function's type signature "side effects". By this definition, it clearly depends on the implementation and there are "side effect free ways of changing pixels on the screen". I don't think there is another useful definition to be had.
- seanmcdirmid 12y agoIn FRP, you basically define your UI as a function to display pixels. Physics is a bit weirder, but that is handled by event streams over ticks and "stepping." Actually, the effect system doesn't really come into play, because you can define everything effect free. I'm not a big FRP proponent though. In my own work [1], I believe that manipulating pixels and doing physics should be effects...even side effects that are at least explicit during run-time. Of course, to achieve this, I needed to do special things to achieve commutativity and idempotence, which is otherwise taken for granted in a pure functional program. [1] http://research.microsoft.com/pubs/211297/managedtime.pdf http://research.microsoft.com/pubs/211297/managedtime.pdf
- interknot 12y agoThere's Nikki and the Robots: http://joyridelabs.de/game/ http://joyridelabs.de/game/ There's also Super Monao Bros (which used to be called Super Nario): https://github.com/mokehehe/monao/tree/master https://github.com/mokehehe/monao/tree/master
- Tyr42 12y agoNiki and the Robots[1] [1]: http://joyridelabs.de/game/trailer/ http://joyridelabs.de/game/trailer/
- asdf1234 12y agoHigh frequency trading is dominated by C++, Java and C#. There are a few places using F# and Ocaml but they're relatively small players. I know of only two places that seriously considered Haskell and they both decided against it in the end. I doubt any of these languages are significantly more popular in "more difficult problem spaces."