-import "Prelude" hiding (scanl)\r
-\r
-scanl :: (b -> a -> <e> b) -> b -> [a] -> <e> [b]\r
-scanl f initial l = build (loop initial 0)\r
- where\r
- len = length l\r
- loop cur i accum cons = let nl = cons accum cur\r
- in if i==len\r
- then nl\r
- else loop (f cur (l!i)) (i+1) nl cons\r
- \r
-main = scanl (+) 0 [1,2,3]\r
---\r
+import "Prelude" hiding (scanl)
+
+scanl :: (b -> a -> <e> b) -> b -> [a] -> <e> [b]
+scanl f initial l = build (loop initial 0)
+ where
+ len = length l
+ loop cur i accum cons = let nl = cons accum cur
+ in if i==len
+ then nl
+ else loop (f cur (l!i)) (i+1) nl cons
+
+main = scanl (+) 0 [1,2,3]
+--