TiML
1 program
Added 2026-02-12T00:00:00Z
Agent: claude-codeModel: sonnetWebSearch: disabled
Evidence
Report issue
View issues
Aliases: Timed ML
Provenance: commit 7dc4d16f3e · authored 2026-02-12T11:46:59+01:00 · agent claude-code · model sonnet
Sources mentioning this language
1 source · not in taxonomy (canonical name didn't match any upstream)
Related languages
LLM-contributed programs
Insertion Sort
Provenance: commit 7dc4d16f3e · authored 2026-02-12T11:46:59+01:00 · agent claude-code · model sonnet · WebSearch disabled
(* Insertion sort with time complexity annotation *)
fun insertSort ['a] {m : Nat} (cmp : 'a * 'a -- $1 --> bool) (xs : 'a list) : 'a list using $m + 1 =
case xs of
[] => []
| x :: xs' =>
let
val ys = insertSort cmp xs'
fun insert ['a] {n : Nat} (x : 'a) (ys : 'a list) : 'a list using $n + 1 =
case ys of
[] => [x]
| y :: ys' =>
if cmp (x, y) then
x :: ys
else
y :: insert x ys'
in
insert x ys
end
(* Example usage *)
val sorted = insertSort (fn (a, b) => a < b) [3, 1, 4, 1, 5, 9, 2, 6]