From a2ebf3467acc703a883403c95eeea28da06c3ca1 Mon Sep 17 00:00:00 2001 From: Aki Date: Thu, 7 Nov 2024 23:02:15 +0100 Subject: Calculate minimum distances to meaningful nodes in transformation graph --- generate.lua | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 generate.lua (limited to 'generate.lua') diff --git a/generate.lua b/generate.lua new file mode 100644 index 0000000..f046356 --- /dev/null +++ b/generate.lua @@ -0,0 +1,33 @@ +local function next_number (last, current) + current = current + 1 + if current > last then + return nil + end + return current +end + + +local function range (first, last) + if first > last then + error "start of range must be less or equal to last value" + end + return next_number, last, first - 1 +end + + +local generate = { + next_number = next_number, + range = range, +} + + +function generate.trange (first, last) + local x = {} + for i in range(first, last) do + table.insert(x, i) + end + return x +end + + +return generate -- cgit v1.1