Opened 14 years ago

Closed 14 years ago

Last modified 12 years ago

#379 closed defect (fixed)

Complete SRFI-46 support

Reported by: sjamaan Owned by: felix winkelmann
Priority: minor Milestone: 4.9.0
Component: core libraries Version: 4.6.x
Keywords: syntax-rules, srfi-46 Cc:
Estimated difficulty:

Description

I got bored so I decided to finish srfi-46 support.

Right now we have support for custom ellipsis identifiers, which is half of SRFI-46. It's much simpler to explain that Chicken supports SRFI-46 than just the ellipsis stuff, and tail patterns provide for slightly more powerful macros.

During my work on it I also found a bug in the way vectors are matched:

(define-syntax foo  (syntax-rules () ((_ #((a) ...)) (list a ...))))
(foo #((1))) => error. It should return (1)

I just dropped the specialized vector matching and converted vectors to list, on match too (it was already done this way for the patterns). This solves any vector-specific bugs and also helps keep the code compact. If speed is an issue, I also have a version that adds SRFI-46 to the vector-specific code.

If there's a better way to do the take-right and drop-right, I'd be happy to hear it.

Attachments (1)

srfi-46.patch (12.0 KB) - added by sjamaan 14 years ago.
Full SRFI-46 support

Download all attachments as: .zip

Change History (7)

Changed 14 years ago by sjamaan

Attachment: srfi-46.patch added

Full SRFI-46 support

comment:1 Changed 14 years ago by felix winkelmann

The patch uses drop-right, which isn't available in csi by default.

comment:2 Changed 14 years ago by sjamaan

It provides its own. Look at the top where the big LET is (line 115)

comment:3 Changed 14 years ago by sjamaan

It looks like tail patterns will make it into WG1 of R7 Scheme, another good reason to include it. (http://lists.scheme-reports.org/pipermail/scheme-reports/2010-October/000075.html)

comment:4 Changed 14 years ago by felix winkelmann

Resolution: fixed
Status: newclosed

Has been added to both experimental and master.

comment:5 Changed 14 years ago by felix winkelmann

Milestone: 4.7.04.8.0

Milestone 4.7.0 deleted

comment:6 Changed 12 years ago by felix winkelmann

Milestone: 4.8.04.9.0

Milestone 4.8.0 deleted

Note: See TracTickets for help on using tickets.