From caf697acd1ee77877b7cbe1c3895c47cd6c2df4c Mon Sep 17 00:00:00 2001 From: Mart Lubbers Date: Thu, 23 Apr 2015 15:10:52 +0200 Subject: started with week2 --- fp2/week2/mart/ReturnEnBind.icl | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 fp2/week2/mart/ReturnEnBind.icl (limited to 'fp2/week2/mart/ReturnEnBind.icl') 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 ... -- cgit v1.2.3