A 'State' monad, and corresponding additions to the code by 'iitalic'#48
A 'State' monad, and corresponding additions to the code by 'iitalic'#48aaronmcdaid wants to merge 4 commits intolexi-lambda:masterfrom
Conversation
|
By the way, I'm relatively new to working with others on github. I've just realised that maybe I should have sent a pull request to @iitalics instead, as this extends their code. I don't really know the etiquette around these things |
|
In an ideal world, I think the right thing to do here would be to define a |
|
I haven't had any time for Hackett in recent weeks, partly because of a C++ conference I attended (Meeting C++ 2017, it was fantastic!). But maybe I will again in a few weeks. I'm going to Nepal on Thursday for three weeks trekking up to 5000m. In future, I may be able to follow up on this, if nobody else does so first. Thanks again for the excellent feedback :-) |
Maybe I've reinvented the wheel, but as an exercise here is an implemention of the State monad (
state.rkt) with the relevantget,putandmodifyoperations.Also, based on that, I've added some relevant functions to
random.rktfor drawing random numbers throughState PRNG:Demo of
(State Integer):This should demo this new functionality for random: