From 179bb51c764737a4a201991d743c25385296466e Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Tue, 14 Apr 2026 19:37:02 +0000 Subject: [PATCH] :bug: Fix gpt/multiply docstring and gpt/abs Point record downcast gpt/multiply had a copy-paste docstring from gpt/subtract claiming it performs subtraction; corrected to accurately describe multiplication. gpt/abs was using clojure.core/update on a Point record, which returns a plain IPersistentMap instead of a Point instance, causing point? checks on the result to return false. Replaced with a direct pos->Point constructor call using mth/abs on each coordinate. Signed-off-by: Andrey Antukh --- common/src/app/common/geom/point.cljc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/common/src/app/common/geom/point.cljc b/common/src/app/common/geom/point.cljc index fd82a7af2a..f20f4bceb3 100644 --- a/common/src/app/common/geom/point.cljc +++ b/common/src/app/common/geom/point.cljc @@ -151,7 +151,7 @@ (dm/get-prop p2 :y)))) (defn multiply - "Returns the subtraction of the supplied value to both + "Returns the multiplication of the supplied value to both coordinates of the point as a new point." [p1 p2] (assert (and (point? p1) @@ -509,12 +509,10 @@ (let [old-length (length vector)] (scale vector (/ new-length old-length)))) -;; FIXME: perfromance (defn abs [point] - (-> point - (update :x mth/abs) - (update :y mth/abs))) + (pos->Point (mth/abs (dm/get-prop point :x)) + (mth/abs (dm/get-prop point :y)))) ;; --- Debug