changed lazy_iterators test
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Mon, 15 Nov 2021 16:04:26 +0000 (10:04 -0600)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Mon, 15 Nov 2021 16:04:26 +0000 (10:04 -0600)
src/polymorph.c
tests/lazy_iterators
tests/lazy_iterators.onyx

index dd3c6dff70f8674724f4bd28cbc2e98d457ba525..cfa25705b67b909e3704ad3218e3263df5754a59 100644 (file)
@@ -125,7 +125,6 @@ static b32 add_solidified_function_entities(AstSolidifiedFunction *solidified_fu
     solidified_func->func_header_entity  = entity_header;
     solidified_func->func->entity_header = entity_header;
     solidified_func->func->entity_body   = entity_body;
-
     return 1;
 }
 
index 24126473185884cf6f97f88cd4c6473fa0ec5dc4..8a60478c78911b526320a6b15680315559a1235f 100644 (file)
@@ -1,9 +1,9 @@
-Closing the count iterator...
 54.0000
 56.0000
 58.0000
 60.0000
 62.0000
+Closing the count iterator...
 Starting the iteration...
 54
 56
@@ -11,7 +11,6 @@ Starting the iteration...
 60
 62
 Closing the count iterator...
-Closing the count iterator...
 58
 
 Starting the zipped iteration...
index 7eb274a6829a828bc9ea16fa002b833c5c87a50f..8000388fd6ba46fe306498485bf8d34054ca387a 100644 (file)
@@ -38,19 +38,18 @@ main :: (args: [] cstr) {
 
     {
         quick_iterator :=
-                    count_iterator(1.0f, 10.0f)
+                    count_iterator(1.0f, 20.0f)
                     |> iter.map((x) => x * 2)
                     |> iter.filter((x) => x > 10)
                     |> iter.map((x) => x + 42)
-                    |> iter.take(5)
-                    |> iter.to_array();
+                    |> iter.take(5);
 
         for v: quick_iterator {
             println(v);
         }
     }
 
-    iterator := count_iterator(1, 10)
+    iterator := iter.as_iterator(1 .. 11)
                 |> iter.map((x: i32) -> i32     { return x * 2; })
                 |> iter.filter((x: i32) -> bool { return x > 10; })
                 |> iter.map((x: i32) -> i32     { return x + 42; });
@@ -68,9 +67,9 @@ main :: (args: [] cstr) {
 
     println("\nStarting the zipped iteration...");
     zipped_iterator := count_iterator(1, 10)
-                |> iter.map((x: i32) -> i32     { return x * 2; })
-                |> iter.filter((x: i32) -> bool { return x > 10; })
-                |> iter.map((x: i32) -> i32     { return x + 42; })
+                |> iter.map((x) => x * 2)
+                |> iter.filter((x) => x > 10)
+                |> iter.map((x) => x + 42)
                 |> iter.zip(iter.const(42.0f));
 
     for value: zipped_iterator {