Hi,

On Fri, Mar 17, 2017 at 7:18 AM, Urs Liska <u...@openlilylib.org> wrote:
> Hi Paul,
>
>
> Am 17.03.2017 um 13:12 schrieb Paul:
>> On 03/17/2017 07:37 AM, Urs Liska wrote:
>>
>>> I order to check arguments for its type I've written this shorthand
>>> function:
>>>
>>> #(define (grob-type? grob name)
>>>     (eq? name (assq-ref (ly:grob-property grob 'meta) 'name)))
>>>
>>> which of course does what it's supposed to. But I wonder if there's a
>>> more straightforward way, e.g. a built-in function doing the same?
>>
>> (ly:grob-name some-grob)
>
> Thanks, this was exactly the thing I was sure is available :-)
>
>>
>> Also:
>>
>> (grob::has-interface some-grob some-interface)
>>
>> See:
>> http://lilypond.1069038.n5.nabble.com/Make-Grob-name-accessible-to-Scheme-issue-203090043-by-david-nalesnik-gmail-com-td171933.html
>>
>>
>> (Would be better if we had better docs for scheme functions...)
>
> Hm ...
>
> Best
> Urs
>

You can get more info about public functions with the attached file.
I was planning on getting documentation into the manuals somehow, but
I got hung up with getting the parameters of curried functions.

Also, of course, publicizing a number of these probably won't do
anybody a bit of good.

In lieu of actual documentation, I could add a Scheme function?

HTH,
David
\version "2.19.17"

#(define (get-binding-list iface)
   (ly:module->alist (resolve-module iface)))

#(define (symbol-closure-list iface)
   (let* ((bindings (get-binding-list iface))
          (closures
           (filter
            (lambda (b) (procedure? (cdr b))) ;; closure?
            bindings))
          (closures
           (sort closures
             (lambda (x y) (symbol<? (car x) (car y))))))
     closures))

#(define (omit-markup-functions lst)
   (remove
    (lambda (elt)
      (string-contains (symbol->string (car elt)) "markup"))
    lst))

#(define (symbol-closure-doc-list iface omit-markups?)
   (let* ((closures (symbol-closure-list iface))
          (closures (if omit-markups?
                        (omit-markup-functions closures)
                        closures)))
     (map (lambda (c)
            (list
             (car c)
             (cdr c)
             (or (procedure-documentation (cdr c))
                 "DOCME")))
       closures)))

% UNCOMMENT THE FOLLOWING TO SEND TO A FILE:

%#(set-current-output-port (open-output-file "closures.txt"))

%% boolean determines whether markup commands (which are documented
%% in their Lily syntax) are included.

#(format #t "~:{~a~%~a~%~3t~s~%__________~%~%~}" (symbol-closure-doc-list '(lily) #t))

%#(format #t "~:{~a~%~a~%~3t~s~%__________~%~%~}" (symbol-closure-doc-list '(srfi srfi-1) #f))
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to