From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Praveen D V Newsgroups: gmane.lisp.guile.user Subject: Re: Display on guile Date: Thu, 5 Mar 2009 21:38:25 +0530 Message-ID: <40d5b80e0903050808i2168bf6du423a3df0fc757cec@mail.gmail.com> References: <00163646c1e6e017c404645aa0f2@google.com> <3ae3aa420903050647y1d65d4ecqc6aaced871d7c963@mail.gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1236269373 2108 80.91.229.12 (5 Mar 2009 16:09:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 5 Mar 2009 16:09:33 +0000 (UTC) Cc: guile-user@gnu.org To: linasvepstas@gmail.com Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Thu Mar 05 17:10:49 2009 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LfG9R-0003mC-62 for guile-user@m.gmane.org; Thu, 05 Mar 2009 17:10:26 +0100 Original-Received: from localhost ([127.0.0.1]:35498 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LfG85-0002Wf-O6 for guile-user@m.gmane.org; Thu, 05 Mar 2009 11:09:01 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LfG7c-0002J9-CW for guile-user@gnu.org; Thu, 05 Mar 2009 11:08:32 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LfG7Z-0002IB-NA for guile-user@gnu.org; Thu, 05 Mar 2009 11:08:30 -0500 Original-Received: from [199.232.76.173] (port=55071 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LfG7Z-0002I1-FB for guile-user@gnu.org; Thu, 05 Mar 2009 11:08:29 -0500 Original-Received: from wf-out-1314.google.com ([209.85.200.169]:10883) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LfG7Y-0000FD-R6 for guile-user@gnu.org; Thu, 05 Mar 2009 11:08:29 -0500 Original-Received: by wf-out-1314.google.com with SMTP id 28so4162725wfc.24 for ; Thu, 05 Mar 2009 08:08:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=B8bwiY8u8xcRAPQoXZI68E7WJhIC0Se+EzAbPEYYiDI=; b=stjUr1657HgQJ40RPhI+JIrBpny12c43Sf2mmwvJ0TCVN3ygRz8kZ6PVdzmrxt/ctw aK0EopQnKE50ewbjckmXPsYStN0BGDwhroFEDKJmwQReJ5yq6hB7Oa3uhtFgjrb3yiRO r3MlRoK7RceSfwWUXOF1Nf9+rryud/iARme8U= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=jLTZhcmpCc2TJ2adjiGfL3gOzkOdbD5lRNh/C3oPPbvShEaRs69SS/H0lTseWTvHK0 OwKD0TSK7oDLI9fnNq0AFWurR0zMrXCiuU/N4zF+iQ77gIKx6bUf1llOSsNMNKU5r3FJ R+kO28MNyXxzYuW4eE/US1b0ioqQ8V4z3tMk8= Original-Received: by 10.142.70.11 with SMTP id s11mr592668wfa.141.1236269305123; Thu, 05 Mar 2009 08:08:25 -0800 (PST) In-Reply-To: <3ae3aa420903050647y1d65d4ecqc6aaced871d7c963@mail.gmail.com> X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:7165 Archived-At: hi, On Thu, Mar 5, 2009 at 8:17 PM, Linas Vepstas wrot= e: > 2009/3/5 =A0: >> hi Group, >> >> I executed these commands.. >> >> $ guile >> guile> (define mc (cons 'a 'b)) >> guile> mc >> (a . b) >> guile> (define ml (list 1 2 mc)) >> guile> ml >> (1 2 (a . b)) >> guile> (list mc 1 2 3) >> ((a . b) 1 2 3) >> guile> (define mh (make-hash-table 2)) >> guile> (hashq-create-handle! mh 'one mc) >> (one a . b) >> guile> (hashq-create-handle! mh 'two ml) >> (two 1 2 (a . b)) >> guile> mh >> #(((two 1 2 (a . b)) (one a . b)) ()) Small correction, just checked on my cygwin(on windows now), it prints as #(((two 1 2 (a . b)) ((one a . b))) Also, not sure of the last '()'. Just a did a cut&paste, something went wr= ong. >> guile> (use-modules (ice-9 pretty-print)) >> guile> (pretty-print mh) >> #(((two 1 2 (a . b)) (one a . b)) ()) >> guile> >> >> I was expecting handle:'one of hash:mh to be printed in parens as >> #(((two 1 2 (a . b)) (one (a . b))) ()) > > According to your logic, you must have also been expecting > #(((two (1 2 (a . b))) (one (a . b))) ()) > > which is not what you wrote. No, not at all. All I was expecting(assumed), cons always prints as "( x . y )". Notice 1. In list it is printed as assumed; either first or last element. 2. In hash it prints as assumed; if it is not the first element in value. If ml2 was created as guile> (define ml2 (list mc 1 2)) guile> ml2 ((a . b) 1 2) and if ml2 was used as value in a hash guile> (hashq-create-handle! mh 'one ml2) guile>mh #(((two 1 2 (a . b)) ((one (a . b) 1 2)))) Question remains same, why is the behavior different if value is 'cons'? >> Why is behaviour of print for a hash different from others? >> Am I missing anything? > > When I read the documentation, I see: > Return the (key . value) pair for key in the given hash table. If key > is not in table then create an entry for it with init as the value, > and return that pair. > > Notice the dot between key and value, which means that > hashq-create-handle! behaves like cons, and not like list; > from your mail, it seems that you were expecting it to > behave like list. Hope I'm clear this time. --regards, Paveen