Hello THomas, > ... > Now `core-guile-condition´ feels like a case for `match´, but I > couldn't make it work. > Is this a bad use case and alist searching is always preferable?
I would do this: (define (is-spanner? grob) (match grob ((g-key . g-vals) (let ((meta (assq-ref g-vals 'meta))) (and meta (eq? (assq-ref meta 'class) 'Spanner) g-key))))) Which you could generalize: (define (lp-grob-is-a? grob class) (match grob ((g-key . g-vals) (let ((meta (assq-ref g-vals 'meta))) (and meta (eq? (assq-ref meta 'class) class) g-key))))) Then filtering becomes: (define grobs '((Name-1 . ((foo . x) (bar . y) (buzz . z) (meta . ((name . Name-1) (class . Spanner) (ifaces . (i1 i2 i3)))))) (Name-2 . ((foo . m) (bar . n) (buzz . o) (meta . ((name . Name-2) (class . Not-a-Spanner) (ifaces . (i4 i5 i6)))))) (Name-3 . ((foo . m) (bar . n) (buzz . o) (meta . ((name . Name-3) (class . Spanner) (ifaces . (i7 i8 i9)))))))) scheme@(guile-user)> (filter-map (lambda (grob) (lp-grob-is-a? grob 'Spanner)) grobs) $6 = (Name-1 Name-3) > As a side note. > I'd like to download the "Guile Reference Manual" as one big-page > .html, but couldn't find any for 2.9.1. > Not yet done? No, but you could locally build it, using the glib gendoc.sh script, let me know if you need help with this, I can cook sometig for you ... David.
pgpDLtncfEjE5.pgp
Description: OpenPGP digital signature
_______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user