Hi,

I have to validate symbol-lists in various ways. For example if it must contain exactly two values (in arbitrary order) I can do

    (and (= (length mylist) 2)(memq 'val-a mylist) (memq 'val-b mylist))

To test if only certain values are allowed (but may be there multiple times):

    (every (lambda (elt) (memq elt '(val-a val-b))) mylist)

Now I have a case where one value must be present once and another value at least once, so '(a b b) is valid as well as '(a b) but '(a a b) is invalid.

I can use (filter) and check if the resulting list has exactly one element, but is there a "native" function to either check if an element is in a list exactly once?

Thanks
Urs



_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to