Re: [Chicken-users] command-line-arguments
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 <[EMAIL PROTECTED]>: 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 Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chi�; ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] command-line-arguments
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. /Jörg > > -elf > > On Fri, 10 Oct 2008, Wietse Jacobs wrote: > > > 2008/10/10 Peter Bex <[EMAIL PROTECTED]>: > >> 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 > Chicken-users@nongnu.org > http://lists.nongnu.org/mailman/listinfo/chi�; ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] command-line-arguments
i'd recommend the r5rs primitive 'write' instead of 'display', 'printf', etc, if you want the external representation of your code. :) -elf On Fri, 10 Oct 2008, Wietse Jacobs wrote: 2008/10/10 Peter Bex <[EMAIL PROTECTED]>: 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 Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] command-line-arguments
2008/10/10 Peter Bex <[EMAIL PROTECTED]>: > 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." -- --Wietse ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] command-line-arguments
Hi Wietse On Fri, 10 Oct 2008 16:04:13 +0200 "Wietse Jacobs" <[EMAIL PROTECTED]> wrote: > I've put the following in a file and compiled it with chicken: > > (begin > (display (command-line-arguments)) > (exit)) > > when I run this with: > test.exe "1 argument" > I get: > (1 argument) > > But this looks like a list of 2 arguments where I expected 1. Am I > missing something? Maybe it's just the output format that makes the list look like it contains two elements. Try (pretty-print (command-line-arguments)) instead or try to get the second arg from the list to check if there are two or only one. Here, using bash, I get only one. Best wishes. Mario ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] command-line-arguments
On Fri, Oct 10, 2008 at 04:04:13PM +0200, Wietse Jacobs wrote: > Hello, > > I've put the following in a file and compiled it with chicken: > > (begin > (display (command-line-arguments)) > (exit)) > > when I run this with: > test.exe "1 argument" > I get: > (1 argument) > > But this looks like a list of 2 arguments where I expected 1. Am I > missing something? 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") > (I'm on windows XP, Chicken Version 3.0.0 - windows-mingw32-x86) > > Thanks for your time, > -- > --Wietse Cheers, Peter -- http://sjamaan.ath.cx -- "The process of preparing programs for a digital computer is especially attractive, not only because it can be economically and scientifically rewarding, but also because it can be an aesthetic experience much like composing poetry or music." -- Donald Knuth pgp0UL7UwGLyo.pgp Description: PGP signature ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] command-line-arguments
Hello, I've put the following in a file and compiled it with chicken: (begin (display (command-line-arguments)) (exit)) when I run this with: test.exe "1 argument" I get: (1 argument) But this looks like a list of 2 arguments where I expected 1. Am I missing something? (I'm on windows XP, Chicken Version 3.0.0 - windows-mingw32-x86) Thanks for your time, -- --Wietse ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users