Tidy is a language made for the "Range" Language Design Challenge.
I define a range as an iterable, possibly infinite sequence of numbers, with some sort of start and end point. I will use the following notation to talk about ranges:
[a, b] = all integers between a and b inclusive
[a, b[ = all integers between a and b, excluding b
]a, b] = all integers between a and b, excluding a
]a, b[ = all integers between a and b, excluding a and b
The bounds can be infinite. For example, [1, ∞)
is the range starting at one and continuing infinitely.
Tidy operates on many data types, particularly, through transforming ranges. Let's frame a few problems with these types of ranges.
Suppose we want to check if a number n
is prime. We know that n
cannot be prime if it has any divisors. We know all divisors of n
lie in the range [2, n)
. Consider the following code:
n := 13
divisors := { x : n % x = 0 } from [2, n[
out(count(divisors) = 0)
Let's decompose this. [2, n[
.
(sorry for incomplete tutorial)