[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: \concat markup command
From: |
Werner LEMBERG |
Subject: |
Re: \concat markup command |
Date: |
Fri, 24 Nov 2006 23:19:20 +0100 (CET) |
> another option is to use fold-left or fold-right (srfi-1 IIRC) to do
> the list looping
Ok, here's another try. However, look how `result' is set in the
first `let' block -- what about adding safe-car and safe-cdr (on the
C++ level) which don't signal an error if its argument is the empty
list? The Elisp versions of car and cdr do this by default...
Werner
======================================================================
#(define-markup-command (concat layout props args) (markup-list?)
"Concatenate @var{args} in a horizontal line, without spaces inbetween.
Strings and simple markups are concatenated on the input level, allowing
ligatures. For example, @code{\\concat @{ \"f\" \\simple #\"i\" @}} is
equivalent to @code{\"fi\"}."
(define (concat-string-args arg-list)
(fold-right (lambda (arg result-list)
(let ((result (if (pair? result-list)
(car result-list)
'())))
(if (and (pair? arg) (eqv? (car arg) simple-markup))
(set! arg (cadr arg)))
(if (and (string? result) (string? arg))
(cons (string-append arg result) (cdr result-list))
(cons arg result-list))))
'()
arg-list))
(interpret-markup layout
(prepend-alist-chain 'word-space 0 props)
(make-line-markup (concat-string-args args))))
\relative {
c-\markup { \concat { "f" "i" } \concat { "f" \null "i" } }
c-\markup { \concat { "j" } }
c-\markup { \concat { \tiny { "k" } } }
c-\markup { \concat { "f" \simple #"i" } }
}
- Re: \concat markup command, (continued)
Re: \concat markup command, Erik Sandberg, 2006/11/12
- Re: \concat markup command, Werner LEMBERG, 2006/11/12
- Re: \concat markup command, Han-Wen Nienhuys, 2006/11/13
- Re: \concat markup command, Werner LEMBERG, 2006/11/24
- Re: \concat markup command, Han-Wen Nienhuys, 2006/11/24
- Re: \concat markup command, Werner LEMBERG, 2006/11/24
- Re: \concat markup command,
Werner LEMBERG <=
- Re: \concat markup command, Han-Wen Nienhuys, 2006/11/24
- Re: \concat markup command, Werner LEMBERG, 2006/11/29
- Re: \concat markup command, Han-Wen Nienhuys, 2006/11/29