[CM] metadata on vectors?
Gregg Reynolds
dev at mobileink.com
Mon Jul 26 14:51:36 PDT 2021
Cool. Thanks all.
On Mon, Jul 26, 2021 at 2:18 PM <bil at ccrma.stanford.edu> wrote:
> Here's one way to do that in scheme:
>
> (require mockery.scm)
>
> (define (meta-vector v data)
> (openlet
> (sublet (*mock-vector* 'mock-vector-class)
> 'value v
> 'mock-type 'mock-vector?
> 'meta-data data)))
>
> (define v (meta-vector #(0 1 2) "hiho"))
>
> (display (v 1))
> 1
>
> (display (v 'meta-data))
> hiho
>
> (display v)
> #(0 1 2)
>
> (vector? v)
> #t
>
> heh heh -- the last is a lie of course; it's actually
> a let trying to masquerade as a vector. mockery.scm
> defines several such "mock data" types.
>
> _______________________________________________
> Cmdist mailing list
> Cmdist at ccrma.stanford.edu
> https://cm-mail.stanford.edu/mailman/listinfo/cmdist
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cm-mail.stanford.edu/pipermail/cmdist/attachments/20210726/1bae28d4/attachment.html>
More information about the Cmdist
mailing list