summaryrefslogtreecommitdiff
path: root/fp2/week2/mart/ReturnEnBind.icl
diff options
context:
space:
mode:
authorMart Lubbers2015-04-23 15:10:52 +0200
committerMart Lubbers2015-04-23 15:10:52 +0200
commitcaf697acd1ee77877b7cbe1c3895c47cd6c2df4c (patch)
treee7dc5d36cbe7bb6def2758d93ab3d8d39fdb405f /fp2/week2/mart/ReturnEnBind.icl
parentMerge branch 'master' of github.com:dopefishh/fp1415 (diff)
started with week2
Diffstat (limited to 'fp2/week2/mart/ReturnEnBind.icl')
-rw-r--r--fp2/week2/mart/ReturnEnBind.icl19
1 files changed, 19 insertions, 0 deletions
diff --git a/fp2/week2/mart/ReturnEnBind.icl b/fp2/week2/mart/ReturnEnBind.icl
new file mode 100644
index 0000000..6c3f8e4
--- /dev/null
+++ b/fp2/week2/mart/ReturnEnBind.icl
@@ -0,0 +1,19 @@
+module ReturnEnBind
+
+import StdEnv, Random
+
+Start = (r1, r2, r3, r4, nullRandomSeed, s1, s2, s3)
+ where
+ (r1, s1) = som2 nullRandomSeed
+ (r2, s2) = som2 s1
+ (r3, s3) = som2 s2
+ (r4, _) = som2 s3
+
+(bind1) infix 0 :: (St s a) (a -> (St s b)) -> St s b
+(bind1) f g = uncurry g o f
+
+som2 :: (RandomSeed -> (Int,RandomSeed))
+som2 = (\s -> random s) bind1 (\a -> random (snd a))
+
+seqList1 :: [St s a] -> St s [a]
+seqList1 ...