mattwparas / steel

An embedded scheme interpreter in Rust
Apache License 2.0
1.1k stars 49 forks source link

Add support for pairwise rest args in syntax rules #61

Closed mattwparas closed 9 months ago

mattwparas commented 1 year ago

The syntax-rules implementation is not done in scheme, but instead is done natively in Rust. There is quite a bit of room for improvement here. For example, the ability to deconstruct pairs on patterns is not supported, like so for this let implementation https://www.scheme.com/tspl2d/syntax.html:

(define-syntax let*
  (syntax-rules ()
    ((_ () e1 e2 ...) (let () e1 e2 ...))
    ((_ ((i1 v1) (i2 v2) ...) e1 e2 ...)
     (let ((i1 v1))
       (let* ((i2 v2) ...) e1 e2 ...)))))

The issue here is the (i2 v2) ... - The current implementation only supports ... on single values, not on a pair.

mattwparas commented 9 months ago

Should be fixed now