biwascheme / biwascheme

Scheme interpreter written in JavaScript
http://www.biwascheme.org/
MIT License
745 stars 128 forks source link

Nested unquote-splicing #346

Closed jcubic closed 3 months ago

jcubic commented 6 months ago

It seems that expression ,@,@x is ignored

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

``(,@,@l ,@,@l) 

it should evaluate to:

(quasiquote ((unquote-splicing x y) (unquote-splicing x y)))

BiwaScheme returns:

(quasiquote ((unquote-splicing (unquote-splicing l)) (unquote-splicing (unquote-splicing l))))

You should eval this and get:

(1 2 3 11 22 33)

But BiwaScheme return error:

unquote-splicing(,@) must be inside quasiquote(`) []
jcubic commented 3 months ago

@yhara before you start working on a fix, I suggest reading this article:

There are a lot of different combinations of unquote and unquote-splicing, they all should work.

yhara commented 3 months ago

@jcubic Oh thank you!