unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* Can format procedure output unquoted strings?
@ 2011-04-12 15:44 Whitlock, Bradley D
  2011-04-12 20:18 ` Andy Wingo
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Whitlock, Bradley D @ 2011-04-12 15:44 UTC (permalink / raw)
  To: guile-user@gnu.org

[-- Attachment #1: Type: text/plain, Size: 186 bytes --]

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


[-- Attachment #2: Type: text/html, Size: 1940 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Can format procedure output unquoted strings?
  2011-04-12 15:44 Can format procedure output unquoted strings? Whitlock, Bradley D
@ 2011-04-12 20:18 ` Andy Wingo
  2011-04-12 20:58 ` Thien-Thi Nguyen
  2011-04-12 23:38 ` Mark H Weaver
  2 siblings, 0 replies; 4+ messages in thread
From: Andy Wingo @ 2011-04-12 20:18 UTC (permalink / raw)
  To: Whitlock, Bradley D; +Cc: guile-user@gnu.org

Hi Bradley,

On Tue 12 Apr 2011 17:44, "Whitlock, Bradley D" <bradley.d.whitlock@lmco.com> 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/



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Can format procedure output unquoted strings?
  2011-04-12 15:44 Can format procedure output unquoted strings? Whitlock, Bradley D
  2011-04-12 20:18 ` Andy Wingo
@ 2011-04-12 20:58 ` Thien-Thi Nguyen
  2011-04-12 23:38 ` Mark H Weaver
  2 siblings, 0 replies; 4+ messages in thread
From: Thien-Thi Nguyen @ 2011-04-12 20:58 UTC (permalink / raw)
  To: Whitlock, Bradley D; +Cc: guile-user@gnu.org

() "Whitlock, Bradley D" <bradley.d.whitlock@lmco.com>
() 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!



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Can format procedure output unquoted strings?
  2011-04-12 15:44 Can format procedure output unquoted strings? Whitlock, Bradley D
  2011-04-12 20:18 ` Andy Wingo
  2011-04-12 20:58 ` Thien-Thi Nguyen
@ 2011-04-12 23:38 ` Mark H Weaver
  2 siblings, 0 replies; 4+ messages in thread
From: Mark H Weaver @ 2011-04-12 23:38 UTC (permalink / raw)
  To: Whitlock, Bradley D; +Cc: guile-user@gnu.org

"Whitlock, Bradley D" <bradley.d.whitlock@lmco.com> 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



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-04-12 23:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-12 15:44 Can format procedure output unquoted strings? Whitlock, Bradley D
2011-04-12 20:18 ` Andy Wingo
2011-04-12 20:58 ` Thien-Thi Nguyen
2011-04-12 23:38 ` Mark H Weaver

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).