Skip to content
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

First effort at rand() #69

Merged
merged 1 commit into from Apr 15, 2022
Merged

First effort at rand() #69

merged 1 commit into from Apr 15, 2022

Conversation

yaxu
Copy link
Member

@yaxu yaxu commented Apr 15, 2022

Seems to work, but

"c4*16".velocity(rand)

only gives one random value per cycle. This works as expected:

"c4*16".velocity(rand.struct("t*16"))

This is probably an issue with applicative (or maybe monad) or the way that velocity is combined with value.

Contributes to #46 and #31

@yaxu
Copy link
Member Author

yaxu commented Apr 15, 2022

Applicative looks fine:

console.log("3 4 2".fmap(a => b => a + b).appLeft(rand).firstCycle())
0: Object { whole: {…}, value: 2.168623458594084, stateful: false, … }
​1: Object { whole: {…}, value: 4.2604806162416935, stateful: false, … }
​2: Object { whole: {…}, value: 1.9786392766982317, stateful: false, … }

So I think this will be solved with #60

@yaxu yaxu merged commit 802ed9d into main Apr 15, 2022
@yaxu yaxu deleted the more-functions branch April 15, 2022 09:29
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.

None yet

1 participant