From 15ff547e520c97ed54007b01b5b770207573b74b Mon Sep 17 00:00:00 2001 From: Joseph Ferano Date: Sat, 26 Sep 2026 16:29:38 +0700 Subject: [PATCH 1/3] rand-int stays u64. --- TODO.org | 3 +++ 1 file changed, 3 insertions(+) diff --git a/TODO.org b/TODO.org index e23add54..c54bcdc7 100644 --- a/TODO.org +++ b/TODO.org @@ -10,6 +10,9 @@ pointing at it. A CANCELLED entry carries the one-line reason, because an idea rejected without a record is an idea that gets re-proposed. * Language surface +** CANCELLED rand-int returns i64 +Decided 2026-09-26 (134): rand-int stays u64; write rand-int-range(lo, hi) for a signed +range. ** DONE A literal's reading is fixed where it is bound CLOSED: [2026-09-26] Decision 132, clarifying 117: a vector, map or text literal is typed only when its own From b49c6ad9cd853c1a59c7cf2c389ea4ca2da874e3 Mon Sep 17 00:00:00 2001 From: Joseph Ferano Date: Sat, 26 Sep 2026 16:36:35 +0700 Subject: [PATCH 2/3] The hand-written corpus gets the author's substring-search and sort practice file, updated to current .fln syntax with a main that runs and prints each function. --- test/syntax/handwritten/algorithms.fln | 61 ++++++++++++++++++++++++++ test/syntax/handwritten/algorithms.out | 4 ++ 2 files changed, 65 insertions(+) create mode 100644 test/syntax/handwritten/algorithms.fln create mode 100644 test/syntax/handwritten/algorithms.out diff --git a/test/syntax/handwritten/algorithms.fln b/test/syntax/handwritten/algorithms.fln new file mode 100644 index 00000000..ca251681 --- /dev/null +++ b/test/syntax/handwritten/algorithms.fln @@ -0,0 +1,61 @@ +; A few textbook algorithms written by hand: a substring search and two +; in-place sorts, one typed and one dyn. + +fn find-match(s: str, pattern: str) -> i32 + for i in range(length(s)) + let matched = true + for j in range(length(pattern)) + if s[i + j] != pattern[j] + matched = false + if matched + return i + -1 + +fn selection-sort(coll: [$t]) -> () where is-ordered($t) + let len = length(coll) + for i in range(len) + let min-val = i + for j in range(i + 1, len) + if coll[j] < coll[min-val] + min-val = j + let tmp = coll[min-val] + coll[min-val] = coll[i] + coll[i] = tmp + +fn insertion-sort(coll: [$t]) -> () where is-ordered($t) + let i = 1 + let length = length(coll) + while i < length + let j = i + while j > 0 and coll[j] < coll[dec(j)] + let temp = coll[j] + coll[j] = coll[dec(j)] + coll[dec(j)] = temp + --(j) + ++(i) + +fn insertion-sort-dyn(coll) -> () + let i = 1 + let length = length(coll) + while i < length + let j = i + while j > 0 and coll[j] < coll[dec(j)] + let temp = coll[j] + coll[j] = coll[dec(j)] + coll[dec(j)] = temp + --(j) + ++(i) + +fn main() -> i32 + let nums = [6 2 4 9 1 9 4 5] + selection-sort(slice(nums)) + println("selection-sort", slice(nums)) + let nums2 = [6 2 4 9 1 9 4 5] + insertion-sort(slice(nums2)) + println("insertion-sort", slice(nums2)) + let word = bytes("INSERTIONSORT") + defer free(word) + insertion-sort-dyn(word) + println("insertion-sort-dyn", str(word)) + println("find-match", find-match("aababba", "abba")) + 0 diff --git a/test/syntax/handwritten/algorithms.out b/test/syntax/handwritten/algorithms.out new file mode 100644 index 00000000..30927a0c --- /dev/null +++ b/test/syntax/handwritten/algorithms.out @@ -0,0 +1,4 @@ +selection-sort [1 2 4 4 5 6 9 9] +insertion-sort [1 2 4 4 5 6 9 9] +insertion-sort-dyn EIINNOORRSSTT +find-match 3 From 1763157ef264f9890cf8542411d12be24305218d Mon Sep 17 00:00:00 2001 From: Joseph Ferano Date: Sat, 26 Sep 2026 16:40:59 +0700 Subject: [PATCH 3/3] Forms .fln cannot yet write are recorded. --- TODO.org | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/TODO.org b/TODO.org index c54bcdc7..6fc9c65a 100644 --- a/TODO.org +++ b/TODO.org @@ -10,6 +10,11 @@ pointing at it. A CANCELLED entry carries the one-line reason, because an idea rejected without a record is an idea that gets re-proposed. * Language surface +** TODO .fln cannot write some forms the prelude needs +Found porting the prelude (2026-09-26): =declare= has no statement form; a quasiquote +in the middle of an expression needs =quasiquote(...)=; =if not x= plus a block reads as +=when=, so a template wanting =(if c (do …))= keeps call syntax; a spliced let binding +list needs =let([…]):=. Each needs a .fln spelling now that .fln is the only syntax. ** CANCELLED rand-int returns i64 Decided 2026-09-26 (134): rand-int stays u64; write rand-int-range(lo, hi) for a signed range.