From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Ludovic_Court=C3=A8s?= Newsgroups: gmane.lisp.guile.user Subject: Re: Some reader syntax for data structures Date: Wed, 03 Apr 2019 22:39:01 +0200 Message-ID: <878swqrfh6.fsf@gnu.org> References: <87ef6om260.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="46609"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Wed Apr 03 22:39:57 2019 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hBmft-000C0J-DO for guile-user@m.gmane.org; Wed, 03 Apr 2019 22:39:57 +0200 Original-Received: from localhost ([127.0.0.1]:40659 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hBmfs-00064m-Bo for guile-user@m.gmane.org; Wed, 03 Apr 2019 16:39:56 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:45609) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hBmfI-00063Z-Ho for guile-user@gnu.org; Wed, 03 Apr 2019 16:39:21 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hBmfG-0000Py-Lc for guile-user@gnu.org; Wed, 03 Apr 2019 16:39:20 -0400 Original-Received: from [195.159.176.226] (port=44940 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hBmfC-0008U3-Fu for guile-user@gnu.org; Wed, 03 Apr 2019 16:39:16 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.89) (envelope-from ) id 1hBmf4-000B3w-NZ for guile-user@gnu.org; Wed, 03 Apr 2019 22:39:06 +0200 X-Injected-Via-Gmane: http://gmane.org/ X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 14 Germinal an 227 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Cancel-Lock: sha1:VZtHo2aiUew6tnjatydKrKHx03Y= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 195.159.176.226 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.org gmane.lisp.guile.user:15378 Archived-At: Hello, Alex Vong 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’.