From d37e51b6059699a0accdc8e491bd80f363655142 Mon Sep 17 00:00:00 2001 From: Scott Richmond Date: Fri, 14 Jun 2024 17:21:32 -0400 Subject: [PATCH] don't fold using builting functions --- prelude.ld | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/prelude.ld b/prelude.ld index b6b0c3d..05938a1 100644 --- a/prelude.ld +++ b/prelude.ld @@ -435,7 +435,7 @@ fn add { () -> 0 (x as :number) -> x (x as :number, y as :number) -> base :add (x, y) - (x, y, ...zs) -> fold (base :add, zs, base :add (x, y)) + (x, y, ...zs) -> fold (add, zs, base :add (x, y)) & add vectors ((x1, y1), (x2, y2)) -> (add (x1, x2), add (y1, y2)) } @@ -445,7 +445,7 @@ fn sub { () -> 0 (x as :number) -> x (x as :number, y as :number) -> base :sub (x, y) - (x, y, ...zs) -> fold (base :sub, zs, base :sub (x, y)) + (x, y, ...zs) -> fold (sub, zs, base :sub (x, y)) ((x1, y1), (x2, y2)) -> (base :sub (x1, x2), base :sub (y1, y2)) } @@ -454,7 +454,7 @@ fn mult { () -> 1 (x as :number) -> x (x as :number, y as :number) -> base :mult (x, y) - (x, y, ...zs) -> fold (base :mult, zs, mult (x, y)) + (x, y, ...zs) -> fold (mult, zs, mult (x, y)) (scalar as :number, (x, y)) -> (mult (x, scalar), mult (y, scalar)) ((x, y), scalar as :number) -> mult (scalar, (x, y)) } @@ -706,7 +706,7 @@ fn and { () -> true (x) -> bool (x) (x, y) -> base :and (x, y) - (x, y, ...zs) -> fold (base :and, zs, base :and (x, y)) + (x, y, ...zs) -> fold (and, zs, base :and (x, y)) } fn or { @@ -714,7 +714,7 @@ fn or { () -> true (x) -> bool (x) (x, y) -> base :or (x, y) - (x, y, ...zs) -> fold (base :or, zs, base :or (x, y)) + (x, y, ...zs) -> fold (or, zs, base :or (x, y)) } &&& associative collections: dicts, structs, namespaces