[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Some reader syntax for data structures
From: |
Ludovic Courtès |
Subject: |
Re: Some reader syntax for data structures |
Date: |
Wed, 03 Apr 2019 22:39:01 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) |
Hello,
Alex Vong <address@hidden> 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’.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: Some reader syntax for data structures,
Ludovic Courtès <=