[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[plt-scheme] Re: webserver and print-struct



Paul Graunke wrote:
> Check help-desk for print-convert.  You might get it to do what you
> need with the right hooks installed (current-print-convert-hook
> [hook]).

This is quite clever. I will add it to the good old bag'o'tricks.

But - I still have problems now. I end up with stuff like this in output
file

(quasiquote ((unquote #<struct:entry>) (unquote #<struct:entry>)))

The #<struct:entry> ought to be (make-struct ..)-thingies.

Now the behaviour in DrScheme and in the web-server are not the same.
It has proably something to do with language settings or parametrizations.
Reading the manual the solution ought to be to use (print-struct #t),
but for some reason the web-server does not respect it.
(Or at least: that's way it seems - I could have missed something)

My functions are

(define (load-book)
  (let* ([port (open-input-file filnavn)]
         [book (eval (read port))])
    (close-input-port port)
    (map convert-entry book)))

(define (save-book)
  (let ([port (open-output-file filename 'replace)])
    ;  (print-struct #t)
    (write (print-convert book) port)
   ; (pretty-print (print-convert bog) port)  ; this is no better
    (close-output-port port)))

[ The pconvert.ss documentation has a small bug:
   "In addition to print-convert, this library provides print-convert, ...
" ]

--
Jens Axel Søgaard