From: Mark Tarver
Subject: Is this a FORMAT error in CLisp?
Date: 
Message-ID: <54781b0b-e605-462d-a0be-8d62b00334be@37g2000yqp.googlegroups.com>
This *looks* like a bug in CLisp

# Python generated from Qi II; 12:21 13/4/2009

(FORMAT NIL "~{~A~}"

'("def " "fact" "(V570)"
 ":
  "
 "if " "0" " == " "V570"
 ":
    "
 " return " "1"
 "
  else"
 ":
    "
 " return " "V570" " * " "fact" "(decrement (V570))"))

gives

"def fact(V570)
:
  if 0 == V570
:
     return 1
  else
:
     return V570 * fact(decrement (V570))"

whereas in SBCL we get

"def fact(V570):
  if 0 == V570:
     return 1
  else:
     return V570 * fact(decrement (V570))"

which is what I'd expect (and want).  Any ideas/work arounds other
than to put a bug report into CLisp?

Mark

From: Mark Tarver
Subject: Re: Is this a FORMAT error in CLisp?
Date: 
Message-ID: <f7be746b-bb9d-4005-a84f-8e8846a03824@x6g2000vbg.googlegroups.com>
On 13 Apr, 12:47, Mark Tarver <··········@ukonline.co.uk> wrote:
> This *looks* like a bug in CLisp
>
> # Python generated from Qi II; 12:21 13/4/2009
>
> (FORMAT NIL "~{~A~}"
>
> '("def " "fact" "(V570)"
>  ":
>   "
>  "if " "0" " == " "V570"
>  ":
>     "
>  " return " "1"
>  "
>   else"
>  ":
>     "
>  " return " "V570" " * " "fact" "(decrement (V570))"))
>
> gives
>
> "def fact(V570)
> :
>   if 0 == V570
> :
>      return 1
>   else
> :
>      return V570 * fact(decrement (V570))"
>
> whereas in SBCL we get
>
> "def fact(V570):
>   if 0 == V570:
>      return 1
>   else:
>      return V570 * fact(decrement (V570))"
>
> which is what I'd expect (and want).  Any ideas/work arounds other
> than to put a bug report into CLisp?
>
> Mark

OK; I have the workaround using COERCE instead.

Mark
From: Thomas A. Russ
Subject: Re: Is this a FORMAT error in CLisp?
Date: 
Message-ID: <ymiskkcgxwq.fsf@blackcat.isi.edu>
I'm wondering if your problem with FORMAT introducing some extraneous
line breaks is because of an interaction with the pretty printer.

Does it do better if you try

(let ((*print-pretty* nil))
  (format nil ...))



-- 
Thomas A. Russ,  USC/Information Sciences Institute
From: Mark Tarver
Subject: Re: Is this a FORMAT error in CLisp?
Date: 
Message-ID: <743dc895-ae70-4910-be18-0dfa2d61bb00@r36g2000vbr.googlegroups.com>
On 13 Apr, 20:24, ····@sevak.isi.edu (Thomas A. Russ) wrote:
> I'm wondering if your problem with FORMAT introducing some extraneous
> line breaks is because of an interaction with the pretty printer.
>
> Does it do better if you try
>
> (let ((*print-pretty* nil))
>   (format nil ...))
>
> --
> Thomas A. Russ,  USC/Information Sciences Institute

I haven't tried that.  This bug (I'm reasonably sure it is a bug) held
me up for a hour or so whilst I fiddled with the code, until I tested
the FORMAT in CLisp.  At any rate I have a workaround.

This indentation thing in Python is a little sticky (hence why FORMAT
needs to be spot on), but I think I've induced the principles for the
examples I've seen.

Mark
From: ········@gmail.com
Subject: Re: Is this a FORMAT error in CLisp?
Date: 
Message-ID: <76bd651f-23de-46dc-857c-ddc0e6734d14@v15g2000yqn.googlegroups.com>
On 13 Apr, 21:24, ····@sevak.isi.edu (Thomas A. Russ) wrote:
> Does it do better if you try
>
> (let ((*print-pretty* nil))
>   (format nil ...))

I tried it, and yes, this solves the problem.