biwascheme / biwascheme

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

Nested unquote-splicing #346

Closed jcubic closed 1 week ago

jcubic commented 3 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 2 weeks 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 2 weeks ago

@jcubic Oh thank you!