mirror of
https://github.com/curioustorvald/tsvm.git
synced 2026-03-14 15:06:05 +09:00
moving everything neatly into the assets directory
This commit is contained in:
8
assets/disk0/home/basic/qsort.bas
Normal file
8
assets/disk0/home/basic/qsort.bas
Normal file
@@ -0,0 +1,8 @@
|
||||
1 REM qsort [] = []
|
||||
2 REM qsort xs = qsort [x | x<-tail xs, x<head xs] ++ [head xs] ++ qsort [x | x<-tail xs, x>=head xs]
|
||||
10 DEFUN LESS(P,X)=X<P
|
||||
11 DEFUN GTEQ(P,X)=X>=P
|
||||
12 DEFUN QSORT(XS)=IF LEN(XS)<1 THEN NIL ELSE QSORT(FILTER(LESS<~HEAD(XS),TAIL(XS))) # HEAD(XS)!NIL # QSORT(FILTER(GTEQ<~HEAD(XS),TAIL(XS)))
|
||||
100 L=7!9!4!5!2!3!1!8!6!NIL
|
||||
110 PRINT L
|
||||
120 PRINT QSORT(L)
|
||||
Reference in New Issue
Block a user