lilypond-user
[Top][All Lists]
Advanced

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

Re: Define markup with iteration


From: tisimst
Subject: Re: Define markup with iteration
Date: Tue, 14 Apr 2015 10:03:14 -0700 (MST)

PIerre,

Your original post said that "\markup \staff-lines-it #5 ..." should create 5 staff lines? If so, there's no need for the 1+ in (iota (1+ n)), just (iota n), no? Otherwise #5 will give you 6 staff lines.

Regards,
Abraham

On Tue, Apr 14, 2015 at 10:53 AM, Schneidy [via Lilypond] <[hidden email]> wrote:
Works perfectly.
Thank you very much Paul, et encore merci à toi Gilles!

Cheers,
Pierre

2015-04-14 17:52 GMT+02:00 Paul Morris <[hidden email]>:
Schneidy wrote
> Unfortunately I still cannot get anything.
> So, if I follow your instructions here's what I get:
>
> #(define-markup-command (staff-lines-it layout props n pad long) (number?
> number? number?)
>      (interpret-markup layout props
>          (if (= n 0)
>              (markup (#:path 0.15 `((moveto  0  ,(* pad 0))(lineto  ,long
> ,(* pad 0)))))
>              (markup
>                  (#:combine
>                     (#:path 0.15
>                       (fold
>                         (lambda(i,prev)
>                            (cons
>                               (moveto  0  (* pad i))
>                               (cons
>                                 (lineto  long  (* pad i))
>                                 prev)))
>                           '()
>                           (reverse (iota (1+ n))))
>                     )))
>              )))
>
> \markup\staff-lines-it #5 #1 #10
>
> And does not compile.
> What am I missing?

I made some changes and the version below appears to work.
- (i,prev) --> (i prev)
- no need for (#:combine
- quasi-quoting and unquoting in the lambda in the fold
- move path construction so you can display the path for debugging

Cheers,
-Paul

%%%%%%%%%%%%%%%%%%%%%

\version "2.18.2"

#(define-markup-command (staff-lines-it layout props n pad long)
   (number? number? number?)
   (define the-path
     (fold
      (lambda (i prev)
        (cons
         `(moveto  0  ,(* pad i))
         (cons
          `(lineto  ,long  ,(* pad i))
          prev)))
      '()
      (reverse (iota (1+ n)))))

   ;; (display the-path)

   (interpret-markup layout props
     (if (= n 0)
         (markup (#:path 0.15 `((moveto  0  ,(* pad 0))(lineto  ,long  ,(*
pad 0)))))
         (markup
          (#:path 0.15 the-path )))))

\markup\staff-lines-it #5 #1 #100




--
View this message in context: http://lilypond.1069038.n5.nabble.com/Define-markup-with-iteration-tp174500p174511.html
Sent from the User mailing list archive at Nabble.com.

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
~Pierre



If you reply to this email, your message will be added to the discussion below:
http://lilypond.1069038.n5.nabble.com/Define-markup-with-iteration-tp174500p174513.html
To start a new topic under User, email [hidden email]
To unsubscribe from Lilypond, click here.
NAML



View this message in context: Re: Define markup with iteration
Sent from the User mailing list archive at Nabble.com.

reply via email to

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