From 478417d16d52ccb1c55ea1196ba8d1f8edee51ad Mon Sep 17 00:00:00 2001 From: Vanessa McHale Date: Sat, 22 Feb 2025 14:35:22 -0500 Subject: [PATCH] ok yeah --- test/py/py.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/py/py.py b/test/py/py.py index 377f9fb40..ca32f3dd6 100644 --- a/test/py/py.py +++ b/test/py/py.py @@ -84,3 +84,16 @@ def unstring(isbn): maxpool2d=apple.jit("([(⋉)/* _1e314 (x::M float)] ⨳ {2∘2,2∘2})") maxpool2d(A) assert ((maxpool2d(A)==np.array([[200.,119.],[120.,49.]])).all()) + +hexagon=apple.jit(''' +λ𝜃. +{ + hex ⟜ ⟨(3%2,√3%2),(0,√3),(_3%2,√3%2),(_3%2,_(√3)%2),(0,_(√3)),(3%2,_(√3)%2)⟩; + tie ← [{.x⊳x]; + rot ← λ𝜃.λ(𝑥,𝑦). (𝑥*cos.𝜃-𝑦*sin.𝜃,𝑥*sin.𝜃+𝑦*cos.𝜃); + -- T ← λk.λl.λ(x,y). (x+3*k+(3%2)*l,y+(√3%2)*l); + tie (rot 𝜃'hex) +}''') +expected=np.array([(1.5,0.8660254),(0.,1.73205081),(-1.5,0.8660254),(-1.5,-0.8660254),(0.,-1.73205081),(1.5,-0.8660254),(1.5,0.8660254)], dtype="f8,f8") +actual=hexagon(0) +print(expected);print(actual)