From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: tomas@tuxteam.de Newsgroups: gmane.emacs.help Subject: Re: Hash-tables containing references to hash-tables Date: Mon, 23 Nov 2009 13:41:00 +0100 Message-ID: <20091123124100.GA10283@tomas> References: <7a116be4-52cb-482d-b555-09bc4950d5f7@31g2000vbf.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; x-action=pgp-signed Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1258980521 3167 80.91.229.12 (23 Nov 2009 12:48:41 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 23 Nov 2009 12:48:41 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: =?iso-8859-1?Q?Nordl=F6w?= Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Nov 23 13:48:34 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NCYLK-0004UU-84 for geh-help-gnu-emacs@m.gmane.org; Mon, 23 Nov 2009 13:48:34 +0100 Original-Received: from localhost ([127.0.0.1]:44226 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NCYLJ-0003pe-K5 for geh-help-gnu-emacs@m.gmane.org; Mon, 23 Nov 2009 07:48:33 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NCYKq-0003od-PX for help-gnu-emacs@gnu.org; Mon, 23 Nov 2009 07:48:04 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NCYKl-0003lq-SC for help-gnu-emacs@gnu.org; Mon, 23 Nov 2009 07:48:03 -0500 Original-Received: from [199.232.76.173] (port=35157 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NCYKl-0003lY-H3 for help-gnu-emacs@gnu.org; Mon, 23 Nov 2009 07:47:59 -0500 Original-Received: from alextrapp1.equinoxe.de ([217.22.192.104]:48944 helo=www.elogos.de) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NCYKl-0001b4-3i for help-gnu-emacs@gnu.org; Mon, 23 Nov 2009 07:47:59 -0500 Original-Received: by www.elogos.de (Postfix, from userid 1000) id 5CD3E90048; Mon, 23 Nov 2009 13:41:00 +0100 (CET) Content-Disposition: inline In-Reply-To: <7a116be4-52cb-482d-b555-09bc4950d5f7@31g2000vbf.googlegroups.com> User-Agent: Mutt/1.5.15+20070412 (2007-04-11) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:70047 Archived-At: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Mon, Nov 23, 2009 at 03:12:22AM -0800, Nordl=C3=B6w wrote: > Is it possible for a hash-table to contain a *reference* to another > hash-table, similar to how we can build arbitrary graphs using conses/ > lists and setf? Yes, it is -- in a way. > If so how? If not, is there reason for being so or is it just an emacs > todo? >=20 > If we have > (puthash parent-key (make-hash-table : size CHILD-SIZE) parent-hash) > then I want > (gethash parent-key parent-hash) > to return a *reference* to hash-table contained in parent-hash. It already does. In Lisp, you _always_ get a reference for anything beyond simple data types (as integers and friends). > I already have a working code for this but I am uncertain how this > will perform when CHILD-SIZE is really large. Ah, it's performance you are worried about. No -- gethash isn't returning a copy of the child table, but "the child table itself". Change it and you'll see... Regards - -- tom=C3=A1s -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFLCoLcBcgs9XrR2kYRAtlJAJ9t4UrnbsYeZTFatyV4qykL5zJ9bwCdGwGq P2MC1udxN7bCG3zGScDgmJI=3D =3DkXCM -----END PGP SIGNATURE-----