Re: Roman numerals in my number sequence

2011-03-18 Thread Gilles THIBAULT



fancy-format becomes the name for the ice-9 format function.



format becomes the name for ergonomic-simple-format.
So you can see that format is redefined to be simple-format.


Thanks Carl.
All is clearer.
So, by default, you should use format and reserve fancy-format for 
specific uses (ie for advanced developpers who know what they do).
For those who want more infos about format, here are 2 links (no so easy 
to find, for me at least) :


simple-format :
http://www.gnu.org/software/guile/manual/guile.html#Writing
format :
http://www.gnu.org/software/guile/manual/guile.html#Formatted-Output

Gilles 




___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Roman numerals in my number sequence

2011-03-17 Thread Adam Good
Carl thank you for the input! Unfortunately I get an error that I
don't know how to do anything with. Below is my input and output.

If you or anyone can help this would be a nice help to me. Thanks!
Adam

@@@

\version 2.12.3

#(define sequence-number 0)

#(define-markup-command (score-sequence layout props sequence-number)
 (number?)
 (interpret-markup layout props
   (markup #:circle (number-string sequence-number

#(set! sequence-number (1+ sequence-number))
\markup { \score-sequence #(fancy-format #f ~@r sequence-number) }

(-- output --)

GNU LilyPond 2.12.3
Processing `Roman_numeral_count.ly'
Parsing...Roman_numeral_count.ly:8:21: In procedure number-string in
expression (number-string sequence-number):
Roman_numeral_count.ly:8:21: Wrong type argument in position 1: I

___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Roman numerals in my number sequence

2011-03-17 Thread Dmytro O. Redchuk
On Thu 17 Mar 2011, 09:13 Adam Good wrote:
 Carl thank you for the input! Unfortunately I get an error that I
 don't know how to do anything with. Below is my input and output.
 
 If you or anyone can help this would be a nice help to me. Thanks!
 Adam
 
 @@@
 
 \version 2.12.3
 
 #(define sequence-number 0)
 
 #(define-markup-command (score-sequence layout props sequence-number)
  (number?)
  (interpret-markup layout props
(markup #:circle (number-string sequence-number
 
 #(set! sequence-number (1+ sequence-number))
 \markup { \score-sequence #(fancy-format #f ~@r sequence-number) }
 
 (-- output --)
 
 GNU LilyPond 2.12.3
 Processing `Roman_numeral_count.ly'
 Parsing...Roman_numeral_count.ly:8:21: In procedure number-string in
 expression (number-string sequence-number):
 Roman_numeral_count.ly:8:21: Wrong type argument in position 1: I
fancy-format feeds I instead of 1 (II instead of 2 etc) to
\score-sequence; since it's what you need (i believe) --- just remove
number-string conversion:

%-8---
#(define sequence-number 0)

% I've renamed sequence-number to sequence-string
% inside score-sequence definition,
% since it's not a number so far:
#(define-markup-command (score-sequence layout props sequence-string)
 (string?)
  (interpret-markup layout props
 (markup #:circle sequence-string)))

#(set! sequence-number (1+ sequence-number))
\markup { \score-sequence #(fancy-format #f ~@r sequence-number) }

#(set! sequence-number (1+ sequence-number))
\markup { \score-sequence #(fancy-format #f ~@r sequence-number) }
%-8---

-- 
  Dmytro O. Redchuk
  Bug Squad

___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Roman numerals in my number sequence

2011-03-17 Thread Adam Good
Completely awesome. Thank you guys so much for your help. Long live
Lilyponders!!

On Thu, Mar 17, 2011 at 9:48 AM, Dmytro O. Redchuk
brownian@gmail.com wrote:
 On Thu 17 Mar 2011, 09:13 Adam Good wrote:
 Carl thank you for the input! Unfortunately I get an error that I
 don't know how to do anything with. Below is my input and output.

 If you or anyone can help this would be a nice help to me. Thanks!
 Adam

 @@@

 \version 2.12.3

 #(define sequence-number 0)

 #(define-markup-command (score-sequence layout props sequence-number)
  (number?)
  (interpret-markup layout props
    (markup #:circle (number-string sequence-number

 #(set! sequence-number (1+ sequence-number))
 \markup { \score-sequence #(fancy-format #f ~@r sequence-number) }

 (-- output --)

 GNU LilyPond 2.12.3
 Processing `Roman_numeral_count.ly'
 Parsing...Roman_numeral_count.ly:8:21: In procedure number-string in
 expression (number-string sequence-number):
 Roman_numeral_count.ly:8:21: Wrong type argument in position 1: I
 fancy-format feeds I instead of 1 (II instead of 2 etc) to
 \score-sequence; since it's what you need (i believe) --- just remove
 number-string conversion:

 %-8---
 #(define sequence-number 0)

 % I've renamed sequence-number to sequence-string
 % inside score-sequence definition,
 % since it's not a number so far:
 #(define-markup-command (score-sequence layout props sequence-string)
  (string?)
  (interpret-markup layout props
     (markup #:circle sequence-string)))

 #(set! sequence-number (1+ sequence-number))
 \markup { \score-sequence #(fancy-format #f ~@r sequence-number) }

 #(set! sequence-number (1+ sequence-number))
 \markup { \score-sequence #(fancy-format #f ~@r sequence-number) }
 %-8---

 --
  Dmytro O. Redchuk
  Bug Squad


___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Roman numerals in my number sequence

2011-03-17 Thread Adam Good
Another tree to bark up and on a similar note, how to set roman
numerals in Score.markFormatter as rehearsal marks via \mark \default
...

\version 2.12.3

\relative c' {
  \set Score.markFormatter = #(fancy-format #f ~@r. 1)

  \mark \default
  a b c d

  \mark \default
  a b c d
}

gives:

warning: type check for `markFormatter' failed; value `I.' must be
of type `procedure'

___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Roman numerals in my number sequence

2011-03-17 Thread Carl Sorensen
On 3/17/11 9:37 AM, Adam Good adamg...@adamgood.com wrote:

 Another tree to bark up and on a similar note, how to set roman
 numerals in Score.markFormatter as rehearsal marks via \mark \default
 ...
 
 \version 2.12.3
 
 \relative c' {
   \set Score.markFormatter = #(fancy-format #f ~@r. 1)
 
   \mark \default
   a b c d
 
   \mark \default
   a b c d
 }
 
 gives:
 
 warning: type check for `markFormatter' failed; value `I.' must be
 of type `procedure'

Right  -- markFormatter needs to be a procedure, so you define it as a
lambda procedure:

\set Score.markFormatter = #(lambda (mark) (fancy-format #f ~@r. mark))

Haven't tested, but this is the general idea.

Carl


___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Roman numerals in my number sequence

2011-03-17 Thread Gilles THIBAULT



Right  -- markFormatter needs to be a procedure, so you define it as a
lambda procedure:
\set Score.markFormatter = #(lambda (mark) (fancy-format #f ~@r. mark))
Haven't tested, but this is the general idea.

This lambda procedure needs 2 arguments.
With :
\set Score.markFormatter = #(lambda (mark context) (fancy-format #f ~@r. 
mark))

It works.

Just a comment :
If you use format instead of fancy-format it works too.
fancy-format doen't seem to be part of guile, so only a function added by 
Lilypond. I found it in output-svg.scm defined as follow :

(define fancy-format format)
So it is exactly the same !
What the advantage to use fancy-format vs format ?

Gilles








___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Roman numerals in my number sequence

2011-03-17 Thread Carl Sorensen
On 3/17/11 5:04 PM, Gilles THIBAULT gilles.thiba...@free.fr wrote:

 fancy-format doen't seem to be part of guile, so only a function added by
 Lilypond. I found it in output-svg.scm defined as follow :
 (define fancy-format format)
 So it is exactly the same !
 What the advantage to use fancy-format vs format ?

Most of the scheme modules in lilypond use a simpler version of format
because it's faster and smaller.

I'm not sure what's happening with output-svg.

Thanks,

Carl


___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Roman numerals in my number sequence

2011-03-17 Thread Carl Sorensen
On 3/17/11 5:04 PM, Gilles THIBAULT gilles.thiba...@free.fr wrote:
 Just a comment :
 If you use format instead of fancy-format it works too.
 fancy-format doen't seem to be part of guile, so only a function added by
 Lilypond. I found it in output-svg.scm defined as follow :
 (define fancy-format format)
 So it is exactly the same !

Look at the whole code:

(define fancy-format format)
(define format ergonomic-simple-format)

fancy-format becomes the name for the ice-9 format function.

format becomes the name for ergonomic-simple-format.

Look at scm/lily.scm:
(define-public fancy-format
   format)
 
(define-public (ergonomic-simple-format dest . rest)
  Like ice-9's @code{format}, but without the memory consumption.
  (if (string? dest)
  (apply simple-format (cons #f (cons dest rest)))
  (apply simple-format (cons dest rest
(define format
  ergonomic-simple-format)

So you can see that format is redefined to be simple-format.

HTH,

Carl


___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Roman numerals in my number sequence

2011-03-16 Thread Carl Sorensen



On 3/16/11 4:16 PM, Adam Good adamg...@adamgood.com wrote:

 Hello,
 Considering that fretboard diagrams can use (number-type .
 roman-lower) how can I get scheme to print Roman numerals in place of
 Arabic numbers in the following sequence?
 
 Thanks

A quick search of scm/fret-diagrams.scm for roman shows

 704  (label-text
 705(cond
 706  ((equal? number-type 'roman-lower)
 707   (fancy-format #f ~(~@r~) base-fret))
 708  ((equal? number-type 'roman-upper)
 709   (fancy-format #f ~@r base-fret))
 710  ((equal? 'arabic number-type)
 711   (fancy-format #f ~d base-fret))
 712  (else (fancy-format #f ~(~@r~) base-fret



So if you want to use upper-case roman, you'd do

\markup { \score-sequence #(fancy-format #f ~@r sequence-number) }

and if you want to use lower-case roman, you'd do

\markup { \score-sequence #(fancy-format #f ~(~@r~) sequence-number) }

HTH,

Carl


___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user