navid/haze / commit
1e92eb578acb
Navid M <navidmomtahen@gmail.com> · 2026-12-02
parents: 7eea2cb1926e
Browse files at this commit · Download source
--- a/samples/baseline_2/main.hz+++ b/samples/baseline_2/main.hz@@ -11,7 +11,8 @@ .filter(fn(n) => n % 2 == 0) .map(fn(n) => n * n) .fold(0, add)- print(squares) // 220++ print(squares) const orders = [ Order{ id = 1, qty = 2, price = 30 },@@ -20,8 +21,8 @@ Order{ id = 4, qty = 10, price = 2 }, ] - print(orders.map(total).fold(0, add)) // 295- print(orders.filter(is_big).map(total).fold(0, add)) // 200+ print(orders.map(total).fold(0, add))+ print(orders.filter(is_big).map(total).fold(0, add)) const bulk_ids = orders .filter(fn(o) => o.qty > 1)@@ -37,7 +38,7 @@ .take(4) for n in firsts {- print(n) // 3, 9, 15, 21 (one per line)+ print(n) } print(seq::fold(seq::range(1, 6), 1, fn(acc, n) => acc * n)) // 120