- ,@(map (lambda (prop-elements)
- (let ((ges (gensym))
- (index -1))
- `(and ,@(map (lambda (e)
- (set! index (1+ index))
- (if (music? e)
- (gen-condition `(and (> (length (ly:music-property ,expr ',(car prop-elements)))
- ,index)
- (list-ref (ly:music-property ,expr ',(car prop-elements))
- ,index))
- e)
- #t))
- (cdr prop-elements)))))
- elements-list))))
+ ,@(map
+ (lambda (prop-elements)
+ (let ((ges (gensym))
+ (len (length (cdr prop-elements))))
+ `(let ((,ges (ly:music-property ,expr ',(car prop-elements))))
+ (and (eqv? (length+ ,ges) ,len)
+ ,@(filter-map
+ (lambda (e index)
+ (and (music? e)
+ (gen-condition `(list-ref ,ges ,index) e)))
+ (cdr prop-elements) (iota len))))))
+ elements-list))))