Hello,

Alex Vong <[email protected]> skribis:

> I enjoy the clojure hash-map syntax and I think guile vhash can sort of
> fit this place with a good reader syntax.

I use something like this:

  (define-syntax vhash
    (syntax-rules (=>)
      "Build a vhash with the given key/value mappings."
      ((_)
       vlist-null)
      ((_ (key others ... => value) rest ...)
       (vhash-cons key value
                   (vhash (others ... => value) rest ...)))
      ((_ (=> value) rest ...)
       (vhash rest ...))))

Of course that doesn’t fill the exact same role as a reader syntax since
it doesn’t allow you to transfer a vhash over the wire, but for cases
where you only want to define a literal vhash, I find it “good enough.”

Thanks,
Ludo’.


Reply via email to