git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Add test for closing over an outer variable in a let binding
commit402263d45cf9f78c31f9677abc4c8fbaa81cf27a authorPhil Freeman <paf31@cantab.net> dateSun 23 Mar 2014, 14:36 (13 years ago) parentc34d947
1 file changed+7
examples/passing/Let.purs+7
examples/passing/Let.purs+7
@@ -41,6 +41,12 @@ test7 = let
4141 f x = x
4242 in if f true then f 1 else f 2
4343
44+test8 :: Number -> Number
45+test8 x = let
46+ go y | (x - 0.1 < y * y) && (y * y < x + 0.1) = y
47+ go y = go $ (y + x / y) / 2
48+ in go x
49+
4450main = do
4551 Debug.Trace.print (test1 1)
4652 Debug.Trace.print (test2 1 2)
@@ -49,3 +55,4 @@ main = do
4955 Debug.Trace.print test5
5056 Debug.Trace.print test6
5157 Debug.Trace.print test7
58+ Debug.Trace.print (test8 100)