Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
18
Task/JortSort/Ada/jortsort.adb
Normal file
18
Task/JortSort/Ada/jortsort.adb
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
with Ada.Text_IO, Ada.Containers.Generic_Array_Sort;
|
||||
|
||||
procedure Jortsort is
|
||||
|
||||
function Jort_Sort(List: String) return Boolean is
|
||||
procedure Sort is new Ada.Containers.Generic_Array_Sort
|
||||
(Positive, Character, Array_Type => String);
|
||||
Second_List: String := List;
|
||||
begin
|
||||
Sort(Second_List);
|
||||
return Second_List = List;
|
||||
end Jort_Sort;
|
||||
|
||||
use Ada.Text_IO;
|
||||
begin
|
||||
Put_Line("""abbigail"" sorted: " & Boolean'Image(Jort_Sort("abbigail")));
|
||||
Put_Line("""abbey"" sorted: " & Boolean'Image(Jort_Sort("abbey")));
|
||||
end Jortsort;
|
||||
9
Task/JortSort/Icon/jortsort.icon
Normal file
9
Task/JortSort/Icon/jortsort.icon
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
procedure main(A)
|
||||
if jortsort(A) then write("true") else write("false")
|
||||
end
|
||||
|
||||
procedure jortsort(A)
|
||||
b := sort(A)
|
||||
every i := 1 to *A do if A[i] ~=== b[i] then fail
|
||||
return
|
||||
end
|
||||
11
Task/JortSort/Pluto/jortsort.pluto
Normal file
11
Task/JortSort/Pluto/jortsort.pluto
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
require "table2"
|
||||
|
||||
local function jort_sort(a)
|
||||
local b = a:clone():sort()
|
||||
return a:same(b)
|
||||
end
|
||||
|
||||
local tests = { {1, 2, 3, 4, 5}, {2, 1, 3, 4, 5} }
|
||||
for tests as test do
|
||||
print($"\{{test:concat(", ")}} -> {jort_sort(test) ? "sorted" : "not sorted"}")
|
||||
end
|
||||
3
Task/JortSort/PowerShell/jortsort.ps1
Normal file
3
Task/JortSort/PowerShell/jortsort.ps1
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
function jortsort($a) { -not (Compare-Object $a ($a | sort) -SyncWindow 0)}
|
||||
jortsort @(1,2,3)
|
||||
jortsort @(2,3,1)
|
||||
25
Task/JortSort/VBScript/jortsort.vbs
Normal file
25
Task/JortSort/VBScript/jortsort.vbs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
Function JortSort(s)
|
||||
JortSort = True
|
||||
arrPreSort = Split(s,",")
|
||||
Set arrSorted = CreateObject("System.Collections.ArrayList")
|
||||
'Populate the resorted arraylist.
|
||||
For i = 0 To UBound(arrPreSort)
|
||||
arrSorted.Add(arrPreSort(i))
|
||||
Next
|
||||
arrSorted.Sort()
|
||||
'Compare the elements of both arrays.
|
||||
For j = 0 To UBound(arrPreSort)
|
||||
If arrPreSort(j) <> arrSorted(j) Then
|
||||
JortSort = False
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
End Function
|
||||
|
||||
WScript.StdOut.Write JortSort("1,2,3,4,5")
|
||||
WScript.StdOut.WriteLine
|
||||
WScript.StdOut.Write JortSort("1,2,3,5,4")
|
||||
WScript.StdOut.WriteLine
|
||||
WScript.StdOut.Write JortSort("a,b,c")
|
||||
WScript.StdOut.WriteLine
|
||||
WScript.StdOut.Write JortSort("a,c,b")
|
||||
Loading…
Add table
Add a link
Reference in a new issue