diff options
author | Marvin Borner | 2024-11-27 15:16:11 +0100 |
---|---|---|
committer | Marvin Borner | 2024-11-27 15:16:11 +0100 |
commit | 4b38d1af08288e80a29c84fe02a40ac925331f21 (patch) | |
tree | ba2e959966c1fb4ccb521cf41aaeb7fe2005d775 /samples/fun | |
parent | 96c3527d87766f3fb653c31306eb78317dcbc1cf (diff) |
Monad improvements
Diffstat (limited to 'samples/fun')
-rw-r--r-- | samples/fun/rng-state.bruijn | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/samples/fun/rng-state.bruijn b/samples/fun/rng-state.bruijn index 795bad1..49d77bc 100644 --- a/samples/fun/rng-state.bruijn +++ b/samples/fun/rng-state.bruijn @@ -14,14 +14,9 @@ rand [[[0 1 1]] rng] rand-bool map even? rand -# accumulating bind (reversed) -triple1 rand >>= (rand >>= (rand >>= [[[[[0 3 [0 3 [0 3 [[0]]]]]]]]])) - -:test ((triple1 (+50) [[1]]) =? (+745)) ([[1]]) - # normal bind -triple2 rand >>= [rand >>= [rand >>= [[[0 4 [0 4 [0 4 [[0]]]]]]]]] +triple rand >>= [rand >>= [rand >>= [pure [0 1 2 3]]]] -:test ((triple2 (+50) [[1]]) =? (+595)) ([[1]]) +:test ((triple (+50) [[1]]) =? (+595)) ([[[2]]]) -main string→number → triple2 +main string→number → triple |