[racket] Reader constructor for #<path:....>

From: Laurent (laurent.orseau at gmail.com)
Date: Mon Jul 26 08:29:57 EDT 2010


The reader cannot read #<path:....> forms (is this the right term?).
When the interaction window is in constructor mode, for (build-path "a"
"b"), it writes #<path:a/b>, but this cannot be read back.

First question: would it be possible to make the reader read paths?

Second question: I need this for my own purposes, so I wrote a
(define/provide (write-path p)
  (cons 'build-path
        (map (λ(p-elt)(if (symbol? p-elt)
                          (list 'quote p-elt)
                          (path->string p-elt)))
             (explode-path p))))

> (write-path (build-path 'same 'up "a" "b"))
'(build-path 'same 'up "a" "b")

Does someone know if this is good enough, or am I omitting something
(platform specific maybe)?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20100726/656c7dc7/attachment.html>

Posted on the users mailing list.