From 6ca5c9ae48e0c55b9602a905aaa1faef30a1770d Mon Sep 17 00:00:00 2001 From: Scott Richmond Date: Thu, 12 Jun 2025 16:57:23 -0400 Subject: [PATCH] add int? --- prelude.ld | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/prelude.ld b/prelude.ld index f123366..06b09f3 100644 --- a/prelude.ld +++ b/prelude.ld @@ -1047,6 +1047,11 @@ fn round { (n as :number) -> base :round (n) } +fn int? { + "Tells if a number is an integer." + (n as :number) -> eq? (n, floor (n)) +} + fn range { "Returns the set of integers between start (inclusive) and end (exclusive) as a list: [start, end). With one argument, starts at 0. If end is less than start, returns an empty list." (end as :number) -> base :range (0, end) @@ -1386,6 +1391,7 @@ pkg Prelude { hideturtle! & turtles home! & turtles inc & math + int? & math inv & math inv/0 & math inv/safe & math