News for hackers. Stuff that matters.
Re:Attitudes That Lead to Maintainable Code by simplehuman on Wednesday March 08, 2017 @11:30AM (#13821313)
I would love to learn what a nomad is. Can you explain what it is to someone who already is programming for many years? I just find the Wikipedia article very hard
Re:Attitudes That Lead to Maintainable Code by cosinetau on Wednesday March 08, 2017 @11:45AM (#13821420)
A nomad is something that goes "nom!" ;)

A monad is basically an function, in the algebra sense, that will take a set of input, and map it to a different output.

That's the most simple definition I can give without getting into the math, and it's been a minute since I've really gotten into Group theory.

Maybe through a Haskell tutorial for some hands-on guidance?

http://learnyouahaskell.com/chapters

https://www.youtube.com/watch?v=9QveBbn7t_c

Re:Attitudes That Lead to Maintainable Code by lmm on Wednesday March 08, 2017 @11:55AM (#13821499)
A nomad is a wanderer. A monad is just a particular abstract interface that turns out to come up a lot and so lead to very reusable code. It's hard to talk about monads in general because the concept is very abstract, I find the best thing is to understand a couple of specific examples first (Writer and Future are good simple cases, and then Nondeterminism or Continuation gives you some idea of the powerful things you can do) and then try to work up from there to the abstract part that unifies all these things and lets you write general-purpose functions that will work with any of them.

http://m50d.github.io/2013/01/16/generic-contexts is an explanation of a case where I found myself using the Applicative interface - Monad is very similar to Applicative (it just adds one extra possible operation).

Re:Attitudes That Lead to Maintainable Code by shae on Wednesday March 08, 2017 @02:22PM (#13822848)
My favorite description of monads is "decorators for function composition". You write a chunk of code to compose functions in one place.

That turns out to be extremely useful in many cases.

Even so, I don't believe that monads are the only way to write good code.

Re:Attitudes That Lead to Maintainable Code by btilly on Wednesday March 08, 2017 @02:28PM (#13822914)
Monads are like burritos. This is explained very well at http://blog.plover.com/prog/burritos.html.

In short they are way to automate building new types out of old types in such a way that code written for the old types can immediately be turned into code written for the new types. This allows a lot of otherwise repetitive code that you might otherwise wind up writing to be pushed to your type system. Which in turn makes it feasible to build a richer type system.

Haskell takes this idea to an extreme.

Re:Attitudes That Lead to Maintainable Code by pryelluw on Wednesday March 08, 2017 @11:44AM (#13821409)
Its pretty much a way to chain functions together in order to do something.

This is a good read: http://web.cecs.pdx.edu/~antoy/Courses/TPFLP/lectures/MONADS...

Re:Attitudes That Lead to Maintainable Code by simplehuman on Sunday March 12, 2017 @01:26AM (#13849415)
I hope everyone had fun because of my typo :)