lilypond-devel
[Top][All Lists]
Advanced

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

Re: Geting the list of MIDI instrument names


From: Ralf Mattes
Subject: Re: Geting the list of MIDI instrument names
Date: Thu, 21 Feb 2008 14:21:19 +0000 (UTC)
User-agent: pan 0.120 (Plate of Shrimp)

On Wed, 20 Feb 2008 18:38:22 +0100, Reinhold Kainhofer wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Am Dienstag, 19. Februar 2008 schrieb Ralf Mattes:
>> BTW, I think there is a bug in your invocation of 'format - the stream
>> parameter is missing. And you don't need 'display, #t as a stream
>> designator resolves to (current-output-port). Substitute #t with
>> (current-error-port) to send the list to standard error.
> 
> Well, you are right that it can be done simpler:
> #(map (lambda (x) (format #t "~s~%" (car x))) instrument-names-alist)
> 
> However, the "missing" #t is not a bug, rather a missing optimization. format 
> without a stream designator returns the formatted string, so in this case one 
> really needs a display. However, if you add the stram designator directly to 
> format, it's much shorter (unfortunately, both books on scheme that I have 
> borrowed from the library don't list this, so I didn't know about this until 
> now....).
> 

Are you shure about this? I've to admit that my Scheme is a bit rusty
(living mostly in Common Lisp these days), but that sounds wrong to me. 
IIRC format with a stream designator of NIL/#f returns the formated string.
Here's my little test case:

 ralf$ guile 
guile> ;;; With #t
... (format #t "foo")
fooguile> ;;; With #f
... (format #f "foo")
"foo"
guile> ;;; Your code 
... (format "foo")

Backtrace:
In current input:
   9: 0* [simple-format "foo"]

<unnamed port>:9:1: In procedure simple-format in expression (format "foo"):
<unnamed port>:9:1: Wrong number of arguments to #<primitive-procedure 
simple-format>
ABORT: (wrong-number-of-args)
guile> 



 Hmm, don't really see how your format invocation could possibly be
 implemented  ...

  Cheers, RalfD

> Reinhold
> - --
> - ------------------------------------------------------------------
> Reinhold Kainhofer, Vienna University of Technology, Austria email:
> address@hidden, http://reinhold.kainhofer.com/
>  * Financial and Actuarial Mathematics, TU Wien,
>  http://www.fam.tuwien.ac.at/ * K Desktop Environment,
>  http://www.kde.org, KOrganizer maintainer * Chorvereinigung
>  "Jung-Wien", http://www.jung-wien.at/
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
> 
> iD8DBQFHvGWPTqjEwhXvPN0RAvjxAKCoks6PhIW5ZGfpkTiznx4sN63UtACg1zro
> BDIDuouM+Pq9ac4ZFINdYpQ=
> =tZ6w
> -----END PGP SIGNATURE-----





reply via email to

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