You are not logged in.

#1 2011-11-29 16:43:04

nomilieu
Member
Registered: 2010-07-03
Posts: 133

[clisp] dropping a blank line from output [SOLVED]

Since "Hello World" is not terribly useful, I like to test out a new language by cloning the echo program.
So, here's my first attempt at Common Lisp.

I've got this code so far, but the "-n" switch doesn't really work:

(if (string= (car *args*) "-n")
    (format *standard-output* "~{~A~^ ~}" (cdr *args*)) 
    (format *standard-output* "~{~A~^ ~}~%" *args*))

It seems to work as expected when given no arguments (not terribly useful), but not otherwise (except of course that "-n" doesn't echo).
Instead, I get the rest of the arguments as well as a blank line afterward (which is correct behavior without the switch).

What can I change to prevent the extra blank line from being generated with "-n"?

Last edited by nomilieu (2011-11-29 19:44:41)

Offline

#2 2011-11-29 19:45:44

nomilieu
Member
Registered: 2010-07-03
Posts: 133

Re: [clisp] dropping a blank line from output [SOLVED]

lol @ me

I forgot that my shell's $PS1 on my work computers includes a newline character before the prompt.
It still doesn't really work, but at least I'm not as confused anymore, so I'll mark solved.

Last edited by nomilieu (2011-11-29 19:52:46)

Offline

Board footer

Powered by FluxBB