egallesio / STklos

STklos Scheme
http://stklos.net
GNU General Public License v2.0
68 stars 17 forks source link

`syntax-rules`: accept ellipsis with improper lists -- enhances pattern-matching (brings easy path to incorporate at least two SRFIs) #602

Closed jpellegrini closed 10 months ago

jpellegrini commented 10 months ago

Hi @egallesio !

The reference implementations of SRFIs 227 (optional lambda) and 232 (currying) use ellipsis patterns in improper lists, and STklos currently doesn't handle those. This patch fixes that. Maybe this also allows us to bring the reference implementation of SRFI 197 (pipeline operators), butI didn't test that.

See the description:

mbe:matches-pattern? and mbe:get-bindings did not account for the presence of an ellipsis pattern in an improper list, as in (a b ... c . d). It would call length on the list tail after the ellipsis, which would signal an error.

So, we:

jpellegrini commented 10 months ago

The reference implementations of SRFIs 227 (optional lambda) and 232 (currying) use ellipsis patterns in improper lists,

Ha ha! I just realized you already implemented SRFI 227. Anyway, 232 is ready!

egallesio commented 10 months ago

Great!!! Thanks @jpellegrini. I'm merging it immediately.