[CM] S7 integrated in TIC-80, and bug reports
bil at ccrma.Stanford.EDU
bil at ccrma.Stanford.EDU
Thu Feb 2 10:53:04 PST 2023
Thanks for the info and bug reports. Are you catching
scheme errors or using a repl? In the repl, I get:
(define-macro (test x . args) (list ,@(map car args)))
(test 10 ('x 1) ('y 2))
;unquote (',') occurred outside quasiquote: (test 10 ('x 1) ('y 2))
; (test 10 ('x 1) ('y 2))
; test: (list (unquote (apply-values (map c... ; args: (('x 1) ('y 2))
In other words, you have ",@(...)" but there's no enclosing
quasiquote.
(define-macro (test x) `(car ,x))
(let ((x (cons 1 2))) (set! (test x) 3) x)
;test (a macro) does not have a setter: (set! (test x) 3)
The code (set! (test...)...) only works if the test macro
has a setter (a function that tells set! how to handle it
as the target of set!). Your other case
(let ((x (cons 1 2))) (set! (car x) 3) x)
;(3 . 2)
works because car has a built-in setter in s7 (set-car! is
the standard scheme equivalent).
If you're using s7_eval_c_string or other C-side equivalent,
you need to catch scheme-side errors. There's a section in
s7.html showing one way to do this ("handling scheme errors
in C" or some such title).
More information about the Cmdist
mailing list