5 ms·
Developing Games in Elm
- sanatgersappa 12y agoLoved the explanation of Composition.
- platz 12y ago> An often better alternative to chaining is composition It's not explained, but one of the reasons why is that function composition refactors more easily than chained code. The first operand (i.e. the value) in the chained code alters the semantics of all the subsequent chained code. You cannot replace parts of the chain as easy as you can with vanilla function composition; you always have that first value to worry about, and this reduces reusability slightly (compared to composition)
- deleted 12y ago[deleted]
- RobotCaleb 12y agoSame, but I feel like I'm missing something with one of the examples. squareIsOdd = square >> isEven >> not -- `not` is a built-in function that inverts booleans squareIsOdd 3 == True squareIsOdd 7 == False <-- huh?
- joshschreuder 12y agoYeah I didn't get that either, shouldn't that be False both times? 3^2 = 9 and 7^2 = 49, both odd.
- lsjroberts 12y agoHah, woops. Author here, I switched between odd and even and forgot to update the numbers... I'll fix it.
- lsjroberts 12y agoThanks :)
- btzll 12y agoThe title should be "Useful Elm code which could be useful if you decide to code a game in Elm", not "Developing Games in Elm".
- CmonDev 12y agoThis is typical for functional languages: 1) build a functional language with lots of features but having a really weird ML-style syntax (because 'succinct' and "you don't need those braces") 2) create a try[lang name].com website 3) ? 4) Profit! http://en.wikipedia.org/wiki/Gnomes_(South_Park) http://en.wikipedia.org/wiki/Gnomes_(South_Park)
- zem 12y agoML syntax is only weird if you consider C/ALGOL style the one true normal. if nothing else, the fact that so many languages use it should remove it from the "weird" category; it's simply the style that matches ML-style programming most pleasantly.
- CmonDev 12y ago"most pleasantly" - that is also very subjective.
- iraldir 12y agoI'd love to see an actual game code using FP. Like a snake or something. Is there any performance advantage?
- pjmlp 12y agoCheck "Nikki and the Robots". It was done in Haskell and available on Steam. John Carmack also did a port of Wolf3D to Haskell, during his FP experiments. https://twitter.com/id_aa_carmack/status/331918309916295168 https://twitter.com/id_aa_carmack/status/331918309916295168
- lsjroberts 12y agoThat's what I'm hoping to do over this year. I'm not expecting any particular performance improvement due to it being functional, I just find it more beneficial as a coding style personally.
- Pamar 12y agoStupidly enough, right before clicking on the article I thought that Elm (http://en.wikipedia.org/wiki/Elm_%28email_client%29 http://en.wikipedia.org/wiki/Elm_%28email_client%29) had somehow reached a level of complexity comparable to EMACS...
- thorn 12y agoThere is nothing about developing games in this article! I do not understand why they put such title at all.
- btzll 12y agoClickbait
- lsjroberts 12y agoHi, author here. The reason is because I am using elm to develop games and this is the first in a series I'll be writing as I learn about doing that. It's largely just me collecting my thoughts as I learn.