chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] command-line-arguments


From: Elf
Subject: Re: [Chicken-users] command-line-arguments
Date: Sat, 11 Oct 2008 18:00:59 -0700 (PDT)

On Sat, 11 Oct 2008, Jörg F. Wittenberger wrote:

Am Freitag, den 10.10.2008, 11:19 -0700 schrieb Elf:
i'd recommend the r5rs primitive 'write' instead of 'display', 'printf', etc,
if you want the external representation of your code. :)

That's what would have recommended until a few weeks ago, when I found
"write" to be the source of an incompatibility between two Scheme
systems.


there is no guarantee in r5rs that the external representations (outside of
a few specific cases) will be the same, and the differences between implementations that allow slashification within symbols and those that do
not are specifically mentioned within the rationale.  write gives an external
representation. the external representation is machine-readable back in. for the cases of strings,
(write "string") always displays
"string"
whereas (display "string") always displays
string

... and as (command-line-arguments) returns a list of strings, write is exactly what will display the objects.

(furthermore, the other methods described by various people all become calls to write. eg printf ~S => output object using write (vs ~A, output using
display))

-elf


/Jörg


-elf

On Fri, 10 Oct 2008, Wietse Jacobs wrote:

2008/10/10 Peter Bex <address@hidden>:
On Fri, Oct 10, 2008 at 04:04:13PM +0200, Wietse Jacobs wrote:
  (display (command-line-arguments))

That's (kind of) a limitation of how 'display' works.
#;1> (display (list "foo" "bar"))
(foo bar)

Instead, you want:
#;2> (printf "~S" (list "foo" "bar"))
("foo" "bar")

Thanks everyone!

Note to self: "Don't rely on `display` to tell you what your code does."



_______________________________________________
Chicken-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/chi&#0;

reply via email to

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