On Sun, Apr 28, 2013 at 2:51 PM, Mark H Weaver <m...@netris.org> wrote:

> Panicz Maciej Godek <godek.mac...@gmail.com> writes:
>
> > I've traced something that is not entirely a bug, but which was a
> > little surprise for me. It has to do with the extensions that guile
> > provides to the Scheme language -- namely, uniform vectors and arrays.
> >
> > The (ice-9 match) module offers the syntax
> > (match #(1 2 3)
> > (#(a b c)
> > (list a b c)))
> > ;===> (1 2 3)
> >
> > However, none of the following behaves as one could expect:
> > (match #u8(1 2 3)
> > (#u8(a b c)
> > (list a b c)))
>
> This can't work because a uniform numeric vector cannot hold symbols, so
> #u8(a b c) cannot be represented in the source code.
>
> please note a b c binds to values and is not symbols as in the pmatch
matcher or match quasiquoute
patterns. So with the right binder this could work.


> If you want generic accessors, I guess the array accessors are what you
> want.  Patches to extend the pattern matcher to handle arrays are
> welcome :)


Actually for ice-9 match we would like the upstream version to implement
these concepts
Try ask foof on irc #scheme if he accept a patch to implement this in a
portable way or ask
him if he thinks he could spend time on it!

Only if we could accept a slow implementation of the matcher we can
implement a general vector
matcher by patching vector-ref etc.

/Stefan

Reply via email to