Hi Ben,
When I checked my tune's functions which worked in ver 0.8.9, then one func stopped because error.
What happend this time ???
messages are ........
;(lambda () (random '(1/2 1/2 1/2 1 2))): too many arguments: ((lambda () ...) 0)
; (lambda () (random '(1/2 1/2 1/2 1 2)))
; *stdout*, line 11, position: 556
pia1: (lambda () (random '(1/2 1/2 1/2 1 ...
make-list-with-proc: (cons (func i) lst) ; i: 0, lst: ()
........... and so on ....
What does "too many arguments: ((lambda () ...) 0)" mean ??
Of course, after thinking about it, this lambda expression has no argument but this func was passed one argument 0, so system said too many arguments, maybe ...
A real code in my func is below, though some parts of this code are deleted to simplify original one for this posting.
(make-list-with-proc n (lambda ()(random '(1/2 1/2 1/2 1 2))))
So I checked make-list-with-proc, in ver 0.7 and ver 0.10.0, no difference, ver 0.10.0 has broken indentaition though.
files : .../extempore-n.n./runtime/scheme.xtm
(define (make-list-with-proc lth func)
(if (< lth 1)
'()
(let loop ((i 0)
(lst '()))
(if (>= i lth)
(reverse lst)
(loop (+ i 1) (cons (func i) lst)))))) ; <-------
Oh yes, at last line, func is passed i, so func should have at least one argument !
So I fixed like this ...
(make-list-with-proc n (lambda (_)(random '(1/2 1/2 1/2 1 2))))
Ok, it works well again without error.!
Then I tested like below ......
;; ver 0.8.9 !
;; Oh! these have no error !
(define t10 (lambda () (random '(1 2 3)))) ; t10 has no argument
(t10) ; ok, this is no problem
(t10 5) ;OK wah (of course, error in s7)
(t10 5 10) ;OK waoh !!! (of course, error in s7)
It seems like that the function which has no argement is passed one or more arguments witout any error in tinyscheme !!
;; s7
(make-list-with-proc 4 (lambda (_)(random '(1 2 1/2 3)))) ; ok
(define t1 (lambda () (random '(1 2 3))))
(t1)
(make-list-with-proc 3 t1) ;error, because t1 doesn't have argument
(define t2 (lambda (_) (random '(1 2 3))))
(t2 100);ok
;; ok, because t2 has one argument, not used though
(make-list-with-proc 3 t2)
;; ok, just same as above, just a anonymous function
(make-list-with-proc 3 (lambda (_) (random '(1 2 3))))
(make-list-with-proc 3 random) ;ok bacause random has variadic arguments
(make-list-with-proc 3 print) ;ok because print has variadic argument
s7 seems to evaluate the S-expression more strictly, according to the function definition.
2026年6月24日水曜日 19:55:46 UTC+9 Minoru: