Compare commits

...

2 Commits

Author SHA1 Message Date
Scott Richmond
d37e51b605 don't fold using builting functions 2024-06-14 17:21:32 -04:00
Scott Richmond
5d6d4e723d 0.1.15 2024-06-14 17:18:16 -04:00
3 changed files with 8 additions and 8 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "@ludus/ludus-js-pure", "name": "@ludus/ludus-js-pure",
"version": "0.1.14", "version": "0.1.15",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@ludus/ludus-js-pure", "name": "@ludus/ludus-js-pure",
"version": "0.1.14", "version": "0.1.15",
"license": "GPL-3.0", "license": "GPL-3.0",
"devDependencies": { "devDependencies": {
"shadow-cljs": "^2.26.0", "shadow-cljs": "^2.26.0",

View File

@ -1,6 +1,6 @@
{ {
"name": "@ludus/ludus-js-pure", "name": "@ludus/ludus-js-pure",
"version": "0.1.14", "version": "0.1.15",
"description": "A Ludus interpreter in a pure JS function.", "description": "A Ludus interpreter in a pure JS function.",
"type": "module", "type": "module",
"main": "build/ludus.mjs", "main": "build/ludus.mjs",

View File

@ -435,7 +435,7 @@ fn add {
() -> 0 () -> 0
(x as :number) -> x (x as :number) -> x
(x as :number, y as :number) -> base :add (x, y) (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 & add vectors
((x1, y1), (x2, y2)) -> (add (x1, x2), add (y1, y2)) ((x1, y1), (x2, y2)) -> (add (x1, x2), add (y1, y2))
} }
@ -445,7 +445,7 @@ fn sub {
() -> 0 () -> 0
(x as :number) -> x (x as :number) -> x
(x as :number, y as :number) -> base :sub (x, y) (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)) ((x1, y1), (x2, y2)) -> (base :sub (x1, x2), base :sub (y1, y2))
} }
@ -454,7 +454,7 @@ fn mult {
() -> 1 () -> 1
(x as :number) -> x (x as :number) -> x
(x as :number, y as :number) -> base :mult (x, y) (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)) (scalar as :number, (x, y)) -> (mult (x, scalar), mult (y, scalar))
((x, y), scalar as :number) -> mult (scalar, (x, y)) ((x, y), scalar as :number) -> mult (scalar, (x, y))
} }
@ -706,7 +706,7 @@ fn and {
() -> true () -> true
(x) -> bool (x) (x) -> bool (x)
(x, y) -> base :and (x, y) (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 { fn or {
@ -714,7 +714,7 @@ fn or {
() -> true () -> true
(x) -> bool (x) (x) -> bool (x)
(x, y) -> base :or (x, y) (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 &&& associative collections: dicts, structs, namespaces