lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

type-check list in NR 6.1.1 (was: Time to retire Dynamic_engraver?)


From: Mark Polesky
Subject: type-check list in NR 6.1.1 (was: Time to retire Dynamic_engraver?)
Date: Mon, 29 Jun 2009 11:50:44 -0700 (PDT)

Neil Puttock wrote:
> > 1) I'd like to have all of type-p-name-alist listed in NR 6.1.1
> >   Overview of music functions (programming-interface.itely, line
> >   76). Any objections?
> 
> None here, as long as you automate it (perhaps use a markup command to
> extract and prettify the list entries).
> 
> BTW, there are a few LilyPond-specific predicates missing, since
> they're not currently used for any properties (e.g. ly:skyline?).

Neil,
I regex-grepped ly:[-\x21-\x7E]+\?

then copied the output to a file, 
then made the following search-and-replaces:
"\""  --> " "
"ly:" --> " ly:"
"?"   --> "? "
"\?"  --> "?"

then stored the whole thing as a string and
then did this:

________________________________


(use-modules (srfi sfri-1))

(define (delete-adjacent-duplicates lst)
  (fold-right
    (lambda (elem ret)
      (if (equal? elem (first ret))
          ret
          (cons elem ret)))
    (list (last lst))
    lst))

(define (display-ly-predicates str)
  (for-each
   (lambda (x) (format #t "~a\n" x))
   (delete-adjacent-duplicates
    (map string->symbol
     (filter (lambda (x)
              (and 
               (string=? "?" (string-take-right x 1))
               (< 2 (string-length x))
               (string=? "ly:" (string-take x 3))))
      (sort
       (string-tokenize str)
       ;; this is my own sort; string-ci<? also works.
       ly:string-ci<?))))))
  
(display-ly-predicates my-string)

________________________________


Then I grouped the meaningful portion* of the output into 4
categories:
  NULLARY
  UNARY TYPE-CHECKS
  UNARY STATUS CHECKS
  BINARY
  DEPRECATED

*(I removed "ly:class-bla::foo-bar[?")

So for NR 6.1.1, we want UNARY TYPE-CHECKS.
Here are the categorized lists:

NULLARY (1)
ly:command-line-verbose?

UNARY TYPE-CHECKS (36)
ly:box?
ly:context?
ly:dimension?
ly:dir?
ly:duration?
ly:font-metric?
ly:grob?
ly:grob-array?
ly:input-location?
ly:item?
ly:iterator?
ly:lily-lexer?
ly:lily-parser?
ly:moment?
ly:music?
ly:music-function?
ly:music-list?
ly:music-output?
ly:otf-font?
ly:output-def?
ly:page-marker?
ly:pango-font?
ly:paper-book?
ly:paper-system?
ly:pitch?
ly:prob?
ly:score?
ly:simple-closure?
ly:skyline?
ly:skyline-pair?
ly:source-file?
ly:spanner?
ly:stencil?
ly:stream-event?
ly:translator?
ly:translator-group?

UNARY STATUS CHECKS (3)
ly:parser-has-error?
ly:score-error?
ly:stencil-empty?

BINARY (8)
ly:duration<?
ly:grob-pq<?
ly:in-event-class?
ly:moment<?
ly:pitch<?
ly:position-on-line?
ly:prob-property?
ly:prob-type?

DEPRECATED (2)
ly:paper-def?
ly:verbose?

________________________________


questions:
0) I assume that's all of them?
1) Did I make any mistakes?
2) Can all of the TYPE-CHECKSbe meaningfully passed to a
   music-function?
3) when you write this:
   > None here, as long as you automate it (perhaps use a markup
   > command to extract and prettify the list entries).
   what qualifies as automating? Can I just copy the UNARY
   TYPE-CHECKS to a list and work with that? Is that what you
   meant? Or did you want the UNARY TYPE-CHECKS list to somehow
   be automated, to account for future additions to the list?
   Offhand, I can't imagine a sensible way of doing that.

Thanks.
- Mark



      




reply via email to

[Prev in Thread] Current Thread [Next in Thread]