From 1701bc61e67e04342cb9d68c30a6a70d552aa50e Mon Sep 17 00:00:00 2001 From: Joe Politz Date: Wed, 24 Jan 2024 15:17:13 -0800 Subject: [PATCH] make sure translate only has one definition -- put-image --- src/web/arr/trove/starter2024.arr | 9 +++-- .../modules/starter2024-on-essentials.arr | 36 +++++++++++++++++++ .../pyret-programs/modules/starter2024.arr | 20 +++++++++++ 3 files changed, 62 insertions(+), 3 deletions(-) create mode 100644 test-util/pyret-programs/modules/starter2024-on-essentials.arr create mode 100644 test-util/pyret-programs/modules/starter2024.arr diff --git a/src/web/arr/trove/starter2024.arr b/src/web/arr/trove/starter2024.arr index e9d2fb982..4710141c5 100644 --- a/src/web/arr/trove/starter2024.arr +++ b/src/web/arr/trove/starter2024.arr @@ -1,11 +1,13 @@ use context empty-context import lists as L -import image as I +import image as I import arrays as A import option as O import constants as C -import global as G +import global as G + +provide: negate end provide from L: all, @@ -220,7 +222,6 @@ provide from I: star-sized, text, text-font, - translate, triangle, triangle-aas, triangle-asa, @@ -499,3 +500,5 @@ provide from G: data String, data Table end + +fun negate(n :: Number) -> Number: n * -1 end diff --git a/test-util/pyret-programs/modules/starter2024-on-essentials.arr b/test-util/pyret-programs/modules/starter2024-on-essentials.arr new file mode 100644 index 000000000..3a3e6a52d --- /dev/null +++ b/test-util/pyret-programs/modules/starter2024-on-essentials.arr @@ -0,0 +1,36 @@ +use context essentials2021 + +import constants as C + +E = C.E +shadow PI = C.PI + +sqrt = num-sqrt +expt = num-expt +sqr = num-sqr +abs = num-abs +dilate = scale +shadow translate = put-image +cos = num-cos +sin = num-sin +tan = num-tan +negate = lam(x): -1 * x end + +img = text("Joe", 50, "purple") +img2 = rectangle(1000, 200, "outline", "black") + +check: + sqrt(1) is 1 + expt(2, 3) is 8 + sqr(2) is 4 + abs(-7) is 7 + dilate(2, img) is scale(2, img) + translate(img, 100, 200, img2) is put-image(img, 100, 200, img2) + cos(0) is 1 + sin(0) is 0 + tan(0) is 0 + negate(-8) is 8 + cos(PI) is-roughly ~-1 + sin(PI / 2) is-roughly ~1 + num-exp(1) is-roughly E +end diff --git a/test-util/pyret-programs/modules/starter2024.arr b/test-util/pyret-programs/modules/starter2024.arr new file mode 100644 index 000000000..c4c934b7d --- /dev/null +++ b/test-util/pyret-programs/modules/starter2024.arr @@ -0,0 +1,20 @@ +use context starter2024 + +img = text("Joe", 50, "purple") +img2 = rectangle(1000, 200, "outline", "black") + +check: + sqrt(1) is 1 + expt(2, 3) is 8 + sqr(2) is 4 + abs(-7) is 7 + dilate(2, img) is scale(2, img) + translate(img, 100, 200, img2) is put-image(img, 100, 200, img2) + cos(0) is 1 + sin(0) is 0 + tan(0) is 0 + negate(-8) is 8 + cos(PI) is-roughly ~-1 + sin(PI / 2) is-roughly ~1 + num-exp(1) is-roughly E +end