Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,29 @@
/* jortSort in Jsish, based on the original satire, modified for jsish */
var jortSort = function(arr:array):boolean {
// make a copy
var originalArray = arr.slice(0);
// sort
arr.sort( function(a,b) { return a - b; } );
// compare to see if it was originally sorted
for (var i = 0; i < originalArray.length; ++i) {
if (originalArray[i] !== arr[i]) return false;
}
// yes, the data came in sorted
return true;
};
if (Interp.conf('unitTest')) {
; jortSort([1,2,3]);
; jortSort([3,2,1]);
; jortSort([1, 'snort', 'sort', [1,2], {1:2}]);
; jortSort(['snort', 'sort', 1, [1,2], {1:2}]);
}
/*
=!EXPECTSTART!=
jortSort([1,2,3]) ==> true
jortSort([3,2,1]) ==> false
jortSort([1, 'snort', 'sort', [1,2], {1:2}]) ==> true
jortSort(['snort', 'sort', 1, [1,2], {1:2}]) ==> false
=!EXPECTEND!=
*/