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:41:00 +0530 Message-ID: <40d5b80e0903050811l2bd2e6a2q99ac16754b6d543e@mail.gmail.com> References: <00163646c1e6e017c404645aa0f2@google.com> <3ae3aa420903050647y1d65d4ecqc6aaced871d7c963@mail.gmail.com> <40d5b80e0903050808i2168bf6du423a3df0fc757cec@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 1236269709 3486 80.91.229.12 (5 Mar 2009 16:15:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 5 Mar 2009 16:15:09 +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:16:25 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 1LfGDM-0005zi-4s for guile-user@m.gmane.org; Thu, 05 Mar 2009 17:14:28 +0100 Original-Received: from localhost ([127.0.0.1]:47473 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LfGC0-00040o-Mf for guile-user@m.gmane.org; Thu, 05 Mar 2009 11:13:04 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LfGA3-0003NH-6s for guile-user@gnu.org; Thu, 05 Mar 2009 11:11:03 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LfGA2-0003Mt-GA for guile-user@gnu.org; Thu, 05 Mar 2009 11:11:02 -0500 Original-Received: from [199.232.76.173] (port=55118 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LfGA2-0003Mo-BV for guile-user@gnu.org; Thu, 05 Mar 2009 11:11:02 -0500 Original-Received: from wf-out-1314.google.com ([209.85.200.173]:6550) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LfGA1-0000Uh-QI for guile-user@gnu.org; Thu, 05 Mar 2009 11:11:02 -0500 Original-Received: by wf-out-1314.google.com with SMTP id 28so4163920wfc.24 for ; Thu, 05 Mar 2009 08:11:01 -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=2h+G7lIrUMSh8PbQWYTwYuS7bwvWxdq2zZyHgR/4UtY=; b=WaiMDTqLBw2fzXByHN+fOQhuoHYYBNN1ATeO6i5p62lKly4bxs51wcykIdhVBl0wGZ E5hofy3KhCjwPPsH6P0o1iiWC7FFTDVPsmz+/QXx8+r8Y8Vn9MkGYVAxcT2oZB2pqyuO +43uG8RICuUXFtDQTmKHRRiI3eB+5YoNITRQ0= 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=VMjxw+v/hGTVPaOB1TpoHUrggzHHQ63Ee549G3mdQjbmjgPsceAM0JHz9iZ2jEo6DR jA3cH+2p582LcKiEwCSQQgRD9OohZoZcoJI/UpgUIww7fHbFQcqHiAzEg+DLKjcHFNlW bVqu4nlbbnQc/vveclWlGi6XPy+JDkkw8i92Y= Original-Received: by 10.142.230.7 with SMTP id c7mr594775wfh.97.1236269460966; Thu, 05 Mar 2009 08:11:00 -0800 (PST) In-Reply-To: <40d5b80e0903050808i2168bf6du423a3df0fc757cec@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:7166 Archived-At: On Thu, Mar 5, 2009 at 9:38 PM, Praveen D V wrote: > hi, > > On Thu, Mar 5, 2009 at 8:17 PM, Linas Vepstas wr= ote: >> 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 '()'. =A0Just a did a cut&paste, something wen= t wrong. > >>> 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. =A0All I was expecting(assumed), cons always > prints as "( x . y )". =A0Notice > 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. Please read it as "In hash it prints as assumed; if it is not the ONLY member 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 >