Talk:Monads/Maybe monad: Difference between revisions

From Rosetta Code
Content added Content deleted
Line 6: Line 6:
# Create and compose safe versions (number -> Maybe number) of 3 partial functions (reciprocal, sqrt, log)
# Create and compose safe versions (number -> Maybe number) of 3 partial functions (reciprocal, sqrt, log)
# Show the results of applying the required composition to a specific set of input values. In the ES5 JavaScript example, I have used, for instance [-2, -1, -0.5, 0, 1 / Math.E, 1, 2, Math.E, 3, 4, 5]
# Show the results of applying the required composition to a specific set of input values. In the ES5 JavaScript example, I have used, for instance [-2, -1, -0.5, 0, 1 / Math.E, 1, 2, Math.E, 3, 4, 5]

==Languages to which a Maybe monad is less relevant ?==

Interesting comment on the difficulty of finding something useful for J. I'm not sure whether the implication is that:
* useful things would entail a bit too much complexity, in the case of this monad, or that
* there might be scope for framing these tasks more in terms of a class of '''problem''' than a class of solution ? [[User:Hout|Hout]] ([[User talk:Hout|talk]]) 20:37, 4 February 2016 (UTC)

Revision as of 20:37, 4 February 2016

Perhaps a specific task ?

It can help comparison across languages if there is a specific task with a readily intelligible motivation. Providing a specific set of inputs and expected outputs can make the code even more directly comparable.

One candidate might be to:

  1. Create and compose safe versions (number -> Maybe number) of 3 partial functions (reciprocal, sqrt, log)
  2. Show the results of applying the required composition to a specific set of input values. In the ES5 JavaScript example, I have used, for instance [-2, -1, -0.5, 0, 1 / Math.E, 1, 2, Math.E, 3, 4, 5]

Languages to which a Maybe monad is less relevant ?

Interesting comment on the difficulty of finding something useful for J. I'm not sure whether the implication is that:

  • useful things would entail a bit too much complexity, in the case of this monad, or that
  • there might be scope for framing these tasks more in terms of a class of problem than a class of solution ? Hout (talk) 20:37, 4 February 2016 (UTC)