basic: trying to solve why currying does not work as it should do in recursive function

This commit is contained in:
minjaesong
2020-12-21 17:50:27 +09:00
parent e11038254a
commit 8600207e34
4 changed files with 69 additions and 15 deletions

6
assets/qsort.bas Normal file
View File

@@ -0,0 +1,6 @@
10 DEFUN LESSER(P,X)=X<P
11 DEFUN GTEQ(P,X)=X>=P
12 DEFUN QSORT(XS)=IF LEN(XS)<1 THEN NIL ELSE QSORT(FILTER(CURRY(LESSER,XS(0)),XS)) # XS(0)!NIL # QSORT(FILTER(CURRY(GTEQ,XS(0)),XS))
100 L=7!9!4!5!2!3!1!8!6!NIL
110 SL=QSORT(L)
120 PRINT L:PRINT SL