I hereby claim:
- I am patrickaldis on github.
- I am patrickaldis (https://keybase.io/patrickaldis) on keybase.
- I have a public key ASBVgPesD9hm4xrQMCmrdfBsGxIwRE2PzgiJWdLRLI5CsAo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
Currently Reading - http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html
I've worked through the first 6 examples where you create bind
and unit
functions
for each "would-be" monad. But I'm having trouble understanding the "Random Numbers"
example. (Just after excercise 6)
Slightly confused by how the types of the outputs of f, g are going to agree - Both output b and accept a.
My main problem is with the type signature of bind
for the functions.
While testing gcd
function I ended up needing to know a termination bound
for gcd m n
, so had to investigate how many steps the recursion took.
The case I tested was for gcd 7 5
- it had enough steps. The defintion
for gcd
follows the euclidean algorithm, which reduces gcd a b
to gcd b c
for a smaller c
. At each stage, this reduction is simply c = a rem b
Algorithm terminates in 4 steps: