From 00a5025aab2dd1af6cc5307af6e90aa345fd323d Mon Sep 17 00:00:00 2001 From: "exercism-solutions-syncer[bot]" <211797793+exercism-solutions-syncer[bot]@users.noreply.github.com> Date: Mon, 23 Mar 2026 11:00:17 +0000 Subject: [PATCH] [Sync Iteration] 8th/triangle/2 --- solutions/8th/triangle/2/triangle.8th | 36 +++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 solutions/8th/triangle/2/triangle.8th diff --git a/solutions/8th/triangle/2/triangle.8th b/solutions/8th/triangle/2/triangle.8th new file mode 100644 index 0000000..16832d5 --- /dev/null +++ b/solutions/8th/triangle/2/triangle.8th @@ -0,0 +1,36 @@ +: istriangle? \ n n n -- T +3dup +3dup n:- n:abs swap n:< -3 roll +rot 3dup n:- n:abs swap n:< -3 roll +rot n:- n:abs swap n:< +and and +; + +: equilateral? \ n n n -- T +istriangle? not if 3drop false +else + 2dup n:= -3 roll + rot n:= + drop and +then +; + +: scalene? \ n n n -- T +istriangle? not if 3drop false +else + 2dup n:= not -3 roll + rot 2dup n:= not -3 roll + rot 2dup n:= not -3 roll + 3drop and and +then +; + +: isosceles? \ n n n -- T +istriangle? not if 3drop false +else + 2dup n:= -3 roll + rot 2dup n:= -3 roll + rot 2dup n:= -3 roll + 3drop xor xor +then +;