lips icon indicating copy to clipboard operation
lips copied to clipboard

Unexpected behaviour with nested backquotes

Open mayerrobert opened this issue 9 months ago • 5 comments

When experimenting with nested backquote edgecases the following forms entered into the REPL at https://lips.js.org/ seem to give wrong results:

(define x '(1 2 3))
(define y '(11 22 33))
(define l '(x y))

(eval ``(,@,@l)) 
; => (1 2 3 11 22 33)
; correct


(eval ``(,@,@l ,@,@l))
; => error message:
Cannot read properties of undefined (reading 'use_dynamic')
Call (stack-trace) to see the stack
Thrown exception is in global exception variable,
use (display exception.stack) to display JS stack trace


; (press F5 to reload LIPS)
(define x '(1 2 3))
(define y '(11 22 33))
(define l '(x y))

(eval ``(,@,@l ,@,@l))
; => (1 2 3 11 22 33)
; IMO this should be (1 2 3 11 22 33 1 2 3 11 22 33)


(eval ``(foo ,@,@l ,@,@l ,@,@l xyxxy))
; => (foo 1 2 3 11 22 33)
; should be (foo 1 2 3 11 22 33 1 2 3 11 22 33 1 2 3 11 22 33 xyxxy)

The "should be" results were verified using Gauche v0.9.10 at https://www.tutorialspoint.com/execute_scheme_online.php

mayerrobert avatar May 20 '24 15:05 mayerrobert