Can format procedure output unquoted strings?

2011-04-12 Thread Whitlock, Bradley D
I am trying to get the format procedure to behave like the display procedure 
where it will not surround output to stdout with quotes

Is there a trick do accomplish this?

Thanks,
Brad



Re: Can format procedure output unquoted strings?

2011-04-12 Thread Mark H Weaver
"Whitlock, Bradley D"  writes:
> I am trying to get the format procedure to behave like the display
> procedure where it will not surround output to stdout with quotes

Use "~A" in the format string, which formats the corresponding argument
like `display', whereas "~S" formats like `write'.  For example:

  (format #t "The value is ~A~%" "test") outputs: The value is test
  (format #t "The value is ~S~%" "test") outputs: The value is "test"

 Mark



Re: Can format procedure output unquoted strings?

2011-04-12 Thread Andy Wingo
Hi Bradley,

On Tue 12 Apr 2011 17:44, "Whitlock, Bradley D"  
writes:

> I am trying to get the format procedure to behave like the display procedure 
> where it will not surround output to stdout with quotes

Use ~a instead of ~s.

scheme@(guile-user)> (format #t "~a\n" "foo")
foo
$1 = #t
scheme@(guile-user)> (format #t "~s\n" "foo")
"foo"
$2 = #t

See "Formatted Output" in the manual for all the gory details.

Have fun with Guile,

Andy
-- 
http://wingolog.org/



Re: Can format procedure output unquoted strings?

2011-04-12 Thread Thien-Thi Nguyen
() "Whitlock, Bradley D" 
() Tue, 12 Apr 2011 11:44:52 -0400

   I am trying to get the format procedure to behave like the display procedure
   where it will not surround output to stdout with quotes

   Is there a trick do accomplish this?

Probably the best trick is to explain clearly what you wish to see,
what you do see, and the undesirable difference between them.

Here is a template:

| I'd like to see:(format X Y) => COOL
| but instead i see:  (format X Y) => NOPE
|
| I think NOPE is close but it is not COOL because MISUNDERSTANDING.

Good luck!