On Nov 25, 12:51 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> On Nov 25, 12:50 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> wrote:
>
> > On Nov 25, 12:22 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> > wrote:
>
> > > This approach might just be too inefficient -- perhaps it would be
> >
On Nov 25, 12:50 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> On Nov 25, 12:22 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> wrote:
>
> > This approach might just be too inefficient -- perhaps it would be
> > best to implement the pretty-printer in an imperative style after all.
>
> OTOH
On Nov 25, 12:22 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> This approach might just be too inefficient -- perhaps it would be
> best to implement the pretty-printer in an imperative style after all.
OTOH it is pretty darn nifty...
user> (pp (clojure.xml/parse "http://catless.ncl.ac
On Nov 24, 8:17 pm, Chouser <[EMAIL PROTECTED]> wrote:
> One option: You could use a seq instead of all the various structs.
I took your advice and uploaded the rewrite to the files section in
Google Groups, filename is pretty-printer.clj. It doesn't get a stack
overflow anymore, but it runs out
On Mon, Nov 24, 2008 at 5:27 PM, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
>
> I believe I have fixed all of my stack-space issues except for this
> one annoying function (rewritten from the original since the
> multimethod wasn't buying me much):
>
> (defn flatten [x]
> (let [type (:type x)]
I believe I have fixed all of my stack-space issues except for this
one annoying function (rewritten from the original since the
multimethod wasn't buying me much):
(defn flatten [x]
(let [type (:type x)]
(cond (or (= type :NIL) (= type :TEXT))
x
(= type :CONCAT)
On Nov 18, 12:03 pm, Chouser <[EMAIL PROTECTED]> wrote:
> On Tue, Nov 18, 2008 at 11:29 AM, [EMAIL PROTECTED]
>
> <[EMAIL PROTECTED]> wrote:
>
> > I looked at Wadler's "A Prettier Printer" paper (http://
> > homepages.inf.ed.ac.uk/wadler/papers/prettier/prettier.pdf) and did a
> > rote translation
On Nov 18, 1:20 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> Thanks for the advice. I think this works for show-list-children:
>
> (defn insert-line [x y]
> (doc-concat x (doc-concat (doc-line) y)))
>
> (defn show-list-children [x]
> (cond (empty? x)
> (doc-nil)
> (=
On Nov 18, 1:12 pm, Chouser <[EMAIL PROTECTED]> wrote:
> On Tue, Nov 18, 2008 at 1:05 PM, [EMAIL PROTECTED]
>
> <[EMAIL PROTECTED]> wrote:
>
> > Your implementation needs to get the whole value of pr-str before
> > deciding that it is too long to put on a single line.
>
> That's certainly what i
On Nov 18, 12:53 pm, Meikel Brandmeyer <[EMAIL PROTECTED]> wrote:
> As always: don't copy code blindly! Take a step back and look from a
> distance, how you can *translate* the code. For example, in the
> show-list-children function, the recursion is just used for iteration.
> It starts with x,
On Tue, Nov 18, 2008 at 1:05 PM, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
>
> Your implementation needs to get the whole value of pr-str before
> deciding that it is too long to put on a single line.
That's certainly what it does, but I don't think it has to. My plan
was to use *print-length
Hi,
Am 18.11.2008 um 17:29 schrieb [EMAIL PROTECTED]:
What could be some good strategies to adapt the code I have here to
Clojure, where tail calls are not eliminated and structs are not lazy?
There is the lazy-map package[1], which also allows lazy (struct)maps.
However it is not updated to
On Tue, Nov 18, 2008 at 11:29 AM, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
>
> I looked at Wadler's "A Prettier Printer" paper (http://
> homepages.inf.ed.ac.uk/wadler/papers/prettier/prettier.pdf) and did a
> rote translation of it into Clojure. Then I wrote printing routines
> for sequences a
Hello everyone,
I looked at Wadler's "A Prettier Printer" paper (http://
homepages.inf.ed.ac.uk/wadler/papers/prettier/prettier.pdf) and did a
rote translation of it into Clojure. Then I wrote printing routines
for sequences and maps -- very barebones. They work OK:
user> (def something '(a b c
14 matches
Mail list logo