mirror of
https://github.com/curioustorvald/tsvm.git
synced 2026-03-14 15:06:05 +09:00
basic: making function 'call' within the function-type argument sorta works when you strictly curry them; literal function call seems to return undefined or something (see assets/disk0/home/basic/sinc2.bas)
This commit is contained in:
@@ -3,15 +3,14 @@
|
||||
10 DEFUN SINC(P)=IF P==0 THEN 1.0 ELSE SIN(P)/P
|
||||
20 DEFUN TOCHAR(P,X)=IF (X==ROUND(ZEROLINE+P*AMP)) THEN "@" ELSE IF (X==ZEROLINE) THEN "|" ELSE CHR(250)
|
||||
30 DEFUN SCONCAT(ACC,S)=ACC+S
|
||||
40 REM DEFUN PLOTLINE(X)=FOLD(SCONCAT,CHR(0),MAP(TOCHAR<~X,1 TO ZEROLINE+AMP))
|
||||
41 DEFUN PLOTLINE(F,X)=FOLD(SCONCAT,CHR(0),MAP(TOCHAR<~F(X),1 TO ZEROLINE+AMP))
|
||||
100 FOR I=0 TO 20
|
||||
110 PRINT PLOTLINE(SINC(I))
|
||||
40 REM DEFUN PLOTLINE(X)=FOLD(SCONCAT,"",MAP(TOCHAR<~X,1 TO ZEROLINE+AMP))
|
||||
41 REM PLOTLINE(F,X)=FOLD(SCONCAT,"",MAP(TOCHAR<~F(X),1 TO ZEROLINE+AMP)):REM does not work
|
||||
42 DEFUN PLOTLINE(F,X)=FOLD(SCONCAT,"",MAP(TOCHAR<~F<~X,1 TO ZEROLINE+AMP)):REM WORKS!
|
||||
100 FOR I=-40 TO 40
|
||||
110 PRINT PLOTLINE(SINC,I)
|
||||
120 NEXT
|
||||
999 END
|
||||
|
||||
1000 REM Known bugs
|
||||
1010 DEFUN PLOTLINE(F,X)=FOLD(SCONCAT,CHR(0),MAP(TOCHAR<~F(X),1 TO ZEROLINE+AMP))
|
||||
1011 REM calling user-defined function within DEFUN is not working
|
||||
|
||||
1020 REM empty string literal "" is translated to number zero (another JS blunder)
|
||||
1011 REM calling user-defined function within DEFUN is not working
|
||||
Reference in New Issue
Block a user