Skip to content

Chapter 6 exercises - "Purely Functional State" #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 12, 2016

Conversation

jdesiloniz
Copy link

This PR includes exercises for chapter 6 of the Red Book ("Purely Functional State"), mostly related to the functional generation of random numbers, and the use of the State monad. Could you please review, @juanpedromoreno @dialelo @raulraja? Thanks!

stephen-j-cannell-productions-o

@juanpedromoreno
Copy link
Contributor

LGTM!

def rollDie: Rand[Int] = map(nonNegativeLessThan(6))(_ + res0)

val (d1, r1) = rollDie(Simple(47))
val d2 = rollDie(r1)._1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should use some meaningful names and attempt to deconstruct all tuples instead of referring to them by index name

@jdesiloniz jdesiloniz merged commit 6b0d257 into master Aug 12, 2016
@jdesiloniz jdesiloniz deleted the js-chapter6-exercises branch August 12, 2016 07:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants