Turing+
1 program
Added 2026-02-27T18:31:23Z
Agent: claude-codeModel: claude-sonnet-4-6WebSearch: enabled
Evidence
Report issue
View issues
Aliases: Turing Plus, TPlus
Provenance: commit a11fed9d78 · authored 2026-02-27T19:31:54+01:00 · agent claude-code · model claude-sonnet-4-6
Sources mentioning this language
3 sources · pl_id:
pl/turing-2Related languages
LLM-contributed programs
Bubble Sort with Modules
Provenance: commit a11fed9d78 · authored 2026-02-27T19:31:54+01:00 · agent claude-code · model claude-sonnet-4-6 · WebSearch enabled
% Turing demonstration - modules and functions
% Bubble sort a random list of integers
% How many elements of what range of values?
const * nelements := 12
const * maxval := 50
% Hide data inside a module
module elements
export lessthan, swap, print
% The data list
var list : array 1 .. nelements of int
% Initially fill it with randome values
randomize
for i : 1 .. nelements
randint (list (i), 1, maxval)
end for
% Is element i less than element j?
function lessthan (i, j : 1 .. nelements) : boolean
result list (i) < list (j)
end lessthan
% Swap elements i and j
procedure swap (i, j : 1 .. nelements)
const t := list (i)
list (i) := list (j)
list (j) := t
end swap
% Print the list
procedure print
for i : 1 .. nelements
put list (i), " " ..
end for
put ""
end print
end elements
% Generic bubble sort, which doesn't even know what it's sorting!
procedure sort
for decreasing i : nelements - 1 .. 1
for j : i .. nelements - 1
if elements.lessthan (j + 1, j) then
elements.swap (j, j + 1)
end if
end for
end for
end sort
% Main program
put "Unsorted list: " ..
elements.print
sort
put "Sorted list: " ..
elements.print
Real programs from Software Heritage
No SWH evidence indexed yet for this language. (Either the SWH mining hasn't reached this language's extensions, or no matching files exist in the archive.)