lilypond-user
[Top][All Lists]
Advanced

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

Re: \mark\markup\left-align bug


From: Nicolas Sceaux
Subject: Re: \mark\markup\left-align bug
Date: Fri, 16 Jan 2004 19:33:26 +0100
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux)

Thu, 15 Jan 2004 15:55:39 +0100, Han-Wen a dit : 


 >> \note       (The syntax for this is really bad!  Why not just \note 2. 
 >> <dir>,
 >> and let the computer compute logarithms and count dots?)

 > I added a TODO. If anyone feels challenged, feel free to change. My
 > suggestion:

 >      \note #"2."

This one might be used to parse the duration argument:

(use-modules (ice-9 optargs)
             (ice-9 regex))

(defmacro*-public aif (test-form then-form #:optional else-form)
  "Anaphoric IF. Introduce a binding for `it'"
  `(let ((it ,test-form))
     (if it ,then-form ,else-form)))

(define-public log2 
  (let ((divisor (log 2)))
    (lambda (z) (inexact->exact (/ (log z) divisor)))))

(define (parse-simple-duration duration-string)
  "Parse the `duration-string', eg ''4..'', and return a (log dots) list."
  (aif (regexp-exec (make-regexp "([0-9]+)(\\.*)") duration-string)
       (list (log2 (string->number (match:substring it 1)))
             (aif (match:substring it 2) (string-length it) 0))
       (error "This is not a valid duration string:" duration-string)))


guile> (parse-simple-duration "8..")
(3 2)

nicolas





reply via email to

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