]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/Scanl.scl
Fixed multiple issues causing dangling references to discarded queries
[simantics/platform.git] / tests / org.simantics.scl.compiler.tests / src / org / simantics / scl / compiler / tests / scl / Scanl.scl
index 67821ddef29a19dd5898be1b4e2a24954eee96fe..fca03cdf60aa73553886322b850eefa6c8a36e96 100644 (file)
@@ -1,14 +1,14 @@
-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]
+--
 [0, 1, 3, 6]
\ No newline at end of file