From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Marko Rauhamaa Newsgroups: gmane.lisp.guile.user Subject: Re: cannot compile: srfi-10 define-reader-ctor 'hash '#,( Date: Thu, 14 Aug 2014 00:33:04 +0300 Message-ID: <87ha1gcbxr.fsf@elektro.pacujo.net> References: <87y4w9jog8.fsf@drakenvlieg.flower> <874myvudnk.fsf@gnu.org> <87y4vaf3fr.fsf@drakenvlieg.flower> <87a97buix8.fsf@gnu.org> <878ums17q3.fsf@drakenvlieg.flower> <87r40kce8e.fsf@elektro.pacujo.net> <874mxg14w3.fsf@drakenvlieg.flower> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1407965614 27443 80.91.229.3 (13 Aug 2014 21:33:34 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 13 Aug 2014 21:33:34 +0000 (UTC) Cc: Ludovic =?utf-8?Q?Court=C3=A8s?= , guile-user@gnu.org To: Jan Nieuwenhuizen Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Wed Aug 13 23:33:27 2014 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XHgAa-0008Jp-MX for guile-user@m.gmane.org; Wed, 13 Aug 2014 23:33:20 +0200 Original-Received: from localhost ([::1]:50388 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XHgAa-0005S0-Bc for guile-user@m.gmane.org; Wed, 13 Aug 2014 17:33:20 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60628) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XHgAO-0005OG-41 for guile-user@gnu.org; Wed, 13 Aug 2014 17:33:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XHgAJ-0000Dm-BS for guile-user@gnu.org; Wed, 13 Aug 2014 17:33:08 -0400 Original-Received: from pacujo.net ([83.150.83.132]:44148) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XHgAJ-0000DX-4v; Wed, 13 Aug 2014 17:33:03 -0400 Original-Received: from elektro.pacujo.net (192.168.1.200) by elektro.pacujo.net; Thu, 14 Aug 2014 00:33:04 +0300 Original-Received: by elektro.pacujo.net (sSMTP sendmail emulation); Thu, 14 Aug 2014 00:33:04 +0300 In-Reply-To: <874mxg14w3.fsf@drakenvlieg.flower> (Jan Nieuwenhuizen's message of "Wed, 13 Aug 2014 23:00:44 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 83.150.83.132 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 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-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:11401 Archived-At: Jan Nieuwenhuizen : > Marko Rauhamaa writes: > >>> {"key0": value, "key1": value} >> >> You mean, like, >> >> (hash-map->list cons mytable) > > No; when fed to `read', that produces a list, right? It produces a mapping in the elegant, classical lisp format: the assoc list. A hash table is just an implementation of that mapping. There's barely a better way to externally represent the mapping than an assoc list. I can use a hash table, send an assoc list to communicate the mapping to a peer, who can then decide to store the mapping in an assoc list, balanced tree, hash table, object database or any other suitable internal data structure. Forcing the recipient to read in a hash table would be pointless and, frankly, obnoxious. > I mean an standardized, ascii/utf-8 non-opaque (#) > representation of hash tables, something like > > #,(hash (key0 value0) .. (keyn valuen)) > > that upon `read', produces a hash table. I know what you mean. I just can't imagine much of a practical need for it. If you want to use pretty-printing to dump the internal data structures so you can recreate them later, that wouldn't work anyway. Consider: (define b (cons 'x 'x)) (define a (cons b b)) (pretty-print a) => ((x . x) x . x) (define c '((x . x) x . x)) (eq? (car a) (cdr a)) => #t (eq? (car c) (cdr c)) => #f Marko