From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Munyoki Kilyungi Newsgroups: gmane.lisp.guile.user Subject: Re: Pretty Printing values from a hashmap Date: Thu, 21 Jul 2022 13:14:09 +0300 Message-ID: <86lesmvklq.fsf@bonfacemunyoki.com> References: <86sfmuvne7.fsf@bonfacemunyoki.com> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40881"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) To: Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Thu Jul 21 12:15:37 2022 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oETDS-000AKf-03 for guile-user@m.gmane-mx.org; Thu, 21 Jul 2022 12:15:35 +0200 Original-Received: from localhost ([::1]:58722 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oETDH-0007cB-HT for guile-user@m.gmane-mx.org; Thu, 21 Jul 2022 06:15:27 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37912) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oETCE-0007aj-1U for guile-user@gnu.org; Thu, 21 Jul 2022 06:14:18 -0400 Original-Received: from out5-smtp.messagingengine.com ([66.111.4.29]:60287) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oETCB-00069c-Va for guile-user@gnu.org; Thu, 21 Jul 2022 06:14:17 -0400 Original-Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 0F7065C0077; Thu, 21 Jul 2022 06:14:14 -0400 (EDT) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Thu, 21 Jul 2022 06:14:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= bonfacemunyoki.com; h=cc:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; t=1658398454; x= 1658484854; bh=TppAHPshfHPTuHHcKcohwWc0DSvWTNcH+R9ydkNlEXk=; b=J 1tS3zxqUJz3Gbh4+Dt0HqSncHCfBTGAqnSyV/B3qxh+nAVgDmT3uWBEyBxh+bW7z AQ1WBySA870bGAJR13YR5ApUk2uSnRWlGxbAgZbW1KwxKjzTMDIgvdqVk7ObXEpj iRKR4tnIpBWB5zwk0V665EYQim6Q3Pv+JsSnFXbqcICHA5zWLaiKOw9XmfPPNXD0 9bfsZFGigyHj2nlYeS2YqnSdhg0un85d+6gI/14+YCnk3yux0IKO3fsEfktD4lIR RsjUfIMImE8pgO9xR5Xqq0qrkHNBMuKnzpLc30bNpV2dlGhhVB9D6S6JzC30/6hP OkSwbEwaz96T609rilmXw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1658398454; x=1658484854; bh=TppAHPshfHPTuHHcKcohwWc0DSvW TNcH+R9ydkNlEXk=; b=OdZm+/t8pj3aA9ExzIfAeOYw1EJ/Jzf4cOaK2FqLbpou q87/KFHnyKGLVsTzUqtTsvmaxlgbRksRYtcYqwCFp0jIi15ZSc+hv0/Dea246Ncn /aAocLngpStZClM52NrEw4aBh4VgE+AaD37eLPdYnQ2NTh1n3DyBH/IyLgw4oCy2 HQkUea/8Yj/+85Lnc7a47O9qTQoAQwcEh/kR5x/yVPK+ov0l7gLWPbgXAzgaRTI6 84KHL6XzLap3mj/DwmXX8tT54j+l3ZMh5Fe+k6PUp8fHOJFE/gl1h8AhPRLiC4ou Z3vtDb6qVOfr/JdkpusSU+uXX8375O9vJvZNEFfXdw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrudelledgvdekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufhffjgfkfgggtgesghdtre ertdertdenucfhrhhomhepofhunhihohhkihcumfhilhihuhhnghhiuceomhgvsegsohhn fhgrtggvmhhunhihohhkihdrtghomheqnecuggftrfgrthhtvghrnhepteevtdehkeethf ehgeevkefgkedtfeehuedvueevvdffveegudevgeffgfegueeknecuffhomhgrihhnpehg nhhuphhgrdhnvghtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepmhgvsegsohhnfhgrtggvmhhunhihohhkihdrtghomh X-ME-Proxy: Feedback-ID: ib8a1471e:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Thu, 21 Jul 2022 06:14:12 -0400 (EDT) In-Reply-To: <86sfmuvne7.fsf@bonfacemunyoki.com> (Munyoki Kilyungi's message of "Thu, 21 Jul 2022 12:13:52 +0300") Received-SPF: pass client-ip=66.111.4.29; envelope-from=me@bonfacemunyoki.com; helo=out5-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.io gmane.lisp.guile.user:18442 Archived-At: --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Munyoki Kilyungi anaandika: > Hi! Say I have a hashmap that has nested hashmaps > that I want to inspect. Is there a way to just > printing it out on my display in a > straight-forward way without having to loop inside > the key-value pairs? Printing a hashmap outputs > something like this: > > # FWIW, I've come up with something that looks like: =2D-8<---------------cut here---------------start------------->8--- (use-modules (ice-9 pretty-print)) (define (print-hash-map h) (map (lambda (x) (newline) (display (car x)) (display ":\n") (map (lambda (x) (format #t "~a:\n" (car x)) (pretty-print (hash-map->list cons (cdr x))) (newline)) (hash-map->list cons (cdr x))) (newline)) h)) (print-hash-map (hash-map->list cons (dataset-csv-reader "rand.csv"))) =2D-8<---------------cut here---------------end--------------->8--- I think the above is clanky as I already know the structure of my hashmap before-hand. =2D-=20 (Life is like a pencil that will surely run out, but will leave the beautiful writing of life.) (D4F09EB110177E03C28E2FE1F5BBAE1E0392253F (hkp://keys.gnupg.net)) --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJKBAEBCAA0FiEE1PCesRAXfgPCji/h9buuHgOSJT8FAmLZJvEWHG1lQGJvbmZh Y2VtdW55b2tpLmNvbQAKCRD1u64eA5IlPw5fD/9vqYQIlLskU4dSf2Bi84++HM4x vlBth8PTeX7KJG12XGPj/QIsWRPfj7ObMTxUnY6fwwBhyv2AGwzqos1glE4SqsYa 2mEGIoO4RXijAyg25Qg8GcV2gpSQCHVPpdubiFNjPOmEMkeoJUi3kdDsE766GiLc jnJNfniwAB6XsgHzUQs8BCnMgUotvdru6uIHa8Y3XJrrCic8MfIYxDa9qhNpEFrZ vNG9IcOVPqJBYKCQ2UOS36RW0+k1A/kcNVxROHllb8DuO7z9C0hvliheE/wqQXXi pMemJH9AMNFewDuQVqn7/Ige81OiI5LHYwnyryyflkmYY6WoapmqAZcngdSjPQKY uNeua4il0C/ky61Bj0hdzvtuWG7veikRxTiJ/zXSQxiyhvMMvYd/KbIq8XN+4t0j cAkXNznzF9TNsa6MvzQbKI6Y/nz51UFv4cnuEYXfJBJ2W3eeJ9jBCppRdHe5xq67 lobZfqx8wmednJGAHjZ6ga5PLkpccq9i3HFhk5i6hlsinm/9YYHXpcrw3itCXqij sYkLFbT6Dm5gQ/L6k2IHi1wkgChdNbUExS7L8UZCJTrlGRbxybsdXzlQAcQj0Lu2 B7zX5GWctSiBzTFzDYAxMrck94dED2wqPSQJ2DKKMGQ9BJPXaxHjyUQF4sz/keN5 +cL5kO5n5gmlB2sJDw== =QniO -----END PGP SIGNATURE----- --=-=-=--