From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stephen Berman Newsgroups: gmane.emacs.help Subject: Re: Output an alist from a function Date: Tue, 24 Sep 2024 18:19:38 +0200 Message-ID: <87y13hkorp.fsf@gmx.net> References: Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26306"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Heime via Users list for the GNU Emacs text editor To: Heime Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Sep 24 18:20:21 2024 Return-path: Envelope-to: geh-help-gnu-emacs@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 1st8Gy-0006ha-Rr for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 24 Sep 2024 18:20:20 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1st8GT-0001sB-CT; Tue, 24 Sep 2024 12:19:49 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1st8GQ-0001s3-EY for help-gnu-emacs@gnu.org; Tue, 24 Sep 2024 12:19:46 -0400 Original-Received: from mout.gmx.net ([212.227.15.15]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1st8GN-0002Bk-OF for help-gnu-emacs@gnu.org; Tue, 24 Sep 2024 12:19:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1727194779; x=1727799579; i=stephen.berman@gmx.net; bh=b7FZzjssFf7aGy3V7fjUm8+Y7AFR8pXcxUh1Gp7NDgA=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date: Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=SE8zYeFVb6fQmDG+hIbwRy1JycD/8LwaMSMmexpEQQJ8h8q7qmaitOs3YkPaR+Q/ h08KXw9DeCBUDoclnaEoEMDnvQngvnIoQ4IJ8Bx5RNdZlNEFpLYTezSHQD+cNXRn5 2YQ9psbqvq1dbvqwhm3sXX4q8Ga/MlkE7zYZZVVjc6BvzQD3Zwv5K7bmzc6Hoa2BC LHYQmCK2ormCLFx66CQUGCFP5Nz2jksBkJsuoiMCbfMem0tw2Qls5NEWAIutLqmzW 7HYChUoYTJ7SLMctIjDzZOefRw3fUsYBJ24X1PYOl1S1cK63T0JwGeJb/VWl2xDiq j0gVVoaGruV6kNjmsg== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from strobelfssd ([88.130.48.98]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1M9Wuk-1spqTH1cEW-007XwY; Tue, 24 Sep 2024 18:19:39 +0200 In-Reply-To: (Heime's message of "Mon, 23 Sep 2024 21:42:38 +0000") X-Provags-ID: V03:K1:ZjFuJUB53UZLuoNcmGZ3geghrrTgPxgoHTgecVLuAp8UggxrKFN w6+Yb0VUetDCWsAi9ROHY2kGeiUyTnRX0OSlcpFh3TXBXwslHHY8E1BBBigUHc55B/N7k5y /eM5onqnneNzDPv7+NzP4DtT1s7hEwf1MPYQCt4K60uYYADGC2P744Z95rv/RjW4tDVBrN+ 27B+x1qpWtlr2z/mSELvg== UI-OutboundReport: notjunk:1;M01:P0:wYjHX22GSPM=;g+uvF/N5juonROI2YJbr+ktpu9v 8KBjL5JHnaFVonhyN9FWQ+382RZhxVgUdM1i5/ksF6q/GlBwQ0XqXCq0MHD6JSIepruredcl7 nbUzaSoRdD7R5tKNdMmB1PDjQKsO/MPdhiYc/dUoDml/Zy4fyWWJl02rIY+0UcjNuLOONenj0 xG7izWm7dRYrPO0vXtZqSWxLI+jnf0zkHwjeQJx+ZzngvJDpWAF61F7YiuWrx1WtvQxW1Q/G3 E8pVRameu2LYdIkdLJaAJUQiWLGWqy0Qqv6nSSnpDC9f04ReZgml4ocSItp1R662OWIJc+jGE CGRQ6TRVeddWNydlO5VBJV2jhP8pWxaR3hCqL1l3AXafsp5uLR4w8juDZYkVOIyy70Xt07+w+ b75z3oQJKYSXqVk4NTuBzx9ssGC7VzQjIrJEegNN5yizpu/VACTVCdPTueWJMqSBCcI7W4Ysd lMJxrecG7oan7+bu+B1YW5LDxVxxhCR0tNrvve3YijfC0wgE/Web4xsqmb3vqxYjrvc0eqbYk oAGCcApzFUacCrCEHZmjOKKA3srRl/mqQwVzYEJOWEE10TGWl2lweaqDN5f24xsF1X+EIwZhl P+Pi/yOQRVH8OK9VDpKjgb9u6N5tqSwHx0I5nT1uF8HbUtIk/IHEq2t/oVa7OQybUf70uZlxS iOVKKaGe3WdyKqY946fq3ikp2EGrMvtVr64WqPzl/UaBIw/hUhgzcaKwzGloWOwo9xZEsCKpD UZMrhDduUey1QFJejGUS3jVSW3flDpkWIUi8vbkZ3KtND3OiL2vWQa/0Wobo+f2k/3jO24Mj Received-SPF: pass client-ip=212.227.15.15; envelope-from=stephen.berman@gmx.net; helo=mout.gmx.net 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:148059 Archived-At: On Mon, 23 Sep 2024 21:42:38 +0000 Heime wrot= e: > I have an alist composed of keys and associated directory paths, and wan= t > to output an alist made of the same keys with values being a validation = flag. > Perhaps the problem is the call to mapcar. In the case of the hash tabl= e I have > to call output-table after the maphash. > > (defun dirpath-validation (input-table-or-alist) > "Test validity of directory path for each key." > > (cond > > ((hash-table-p input-table-or-alist) > > ;; Make hash-table for output > (let ( (output-table (make-hash-table :test 'equal)) ) > (maphash (lambda (key dirpath) > (puthash key (not (file-directory-p dirpath)) output-= table)) > input-table-or-alist) > output-table)) > > (t > (mapcar (lambda (entry) > (let ( (key (car entry)) > (dirpath (cdr entry)) ) > (cons key (not (file-directory-p dirpath)))) ) > input-table-or-alist)) )) I get this: (dirpath-validation #s(hash-table data ("a" "/usr" "b" "file"))) =3D=3D> #s(hash-table test equal data ("a" nil "b" t)) (dirpath-validation '(("a" . "/usr") ("b" . "file"))) =3D=3D> (("a") ("b" . t)) What's the problem? Steve Berman