From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Arsen_Arsenovi=C4=87?= Newsgroups: gmane.emacs.help Subject: Re: Difference between cons and dot Date: Sat, 20 Apr 2024 15:35:37 +0200 Message-ID: <86mspo5f86.fsf@aarsen.me> References: Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32497"; mail-complaints-to="usenet@ciao.gmane.io" 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 Sat Apr 20 15:36:33 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 1ryAtM-0008GL-TR for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 20 Apr 2024 15:36:32 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ryAsn-00073n-9n; Sat, 20 Apr 2024 09:35:57 -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 1ryAsg-00072d-OQ for help-gnu-emacs@gnu.org; Sat, 20 Apr 2024 09:35:51 -0400 Original-Received: from mout-p-101.mailbox.org ([80.241.56.151]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.90_1) (envelope-from ) id 1ryAsf-000118-0K for help-gnu-emacs@gnu.org; Sat, 20 Apr 2024 09:35:50 -0400 Original-Received: from smtp202.mailbox.org (smtp202.mailbox.org [10.196.197.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4VMCFV2Jr9z9sSZ; Sat, 20 Apr 2024 15:35:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aarsen.me; s=MBO0001; t=1713620142; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=fWQxzfHbE06aSCouoASf3Cw5Mf9JNu1xxBBOSDFFihU=; b=HjR9DbARzB2inbjnfb8pk1cLI5/Vsx2TRAb5mdfq8u94hHHFGRxpxVLKBDiy6OZHGcqtmD 2L1GwTWwF0zEPw6uPuF4QqJEG+/05JxQWArbnuLole2WQi9qFZe7CypA1mgMDUrVWCgQFC YXKsvb5Pie6soIkGliKvUXys9hZ7aIesVwQRHjAKOEtHSOB/VDxpTHrUubD6W1FngtLgp2 A9l7WwCbCvciJDxHYVQE7dfFVvqP1w5BqPJkwXBL9lt0ICtLJszA8OeCX2F4VRcxPnjrZU edrEPb6zSmNoIfYBHQjp1fcbpyoAykI9CDIV7xOfgs59R69aCVp9TtdDr8ZcNw== In-Reply-To: (Heime's message of "Sat, 20 Apr 2024 12:20:20 +0000") Received-SPF: pass client-ip=80.241.56.151; envelope-from=arsen@aarsen.me; helo=mout-p-101.mailbox.org 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_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:146403 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi, Heime writes: > Am adding an elemnt to an alist using either the cons or dot method. > Have noticed that with cons I do not need to call list=20 > > Thusly=20 > > (push (cons kfrz lnum) tema-lugar) > > rather than > > (push '(cons kfrz lnum) tema-lugar) > > But with the dot method I have to use=20 > > (push '(kfrz . lnum) tema-lugar) > > and not=20 > > (push (kfrz . lnum) tema-lugar) > > What is the reason for this difference ? 'cons' is a primitive function. (cons a b) produces a cons cell "(a . b)". "(a . b)" is a value. Hence, 'cons' has to be called. As (a . b) can't be called, it should be quoted, hence '(a . b). This is actually not a divergence, really; it's consistent with the rest of the language. [NOTE: not sure if I got the nomenclature right.. but the reasoning is correct: cons has to be called, (a . b) does not.] Have a lovely day! =2D-=20 Arsen Arsenovi=C4=87 --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iOYEARYKAI4WIQT+4rPRE/wAoxYtYGFSwpQwHqLEkwUCZiPEql8UgAAAAAAuAChp c3N1ZXItZnByQG5vdGF0aW9ucy5vcGVucGdwLmZpZnRoaG9yc2VtYW4ubmV0RkVF MkIzRDExM0ZDMDBBMzE2MkQ2MDYxNTJDMjk0MzAxRUEyQzQ5MxAcYXJzZW5AYWFy c2VuLm1lAAoJEFLClDAeosSTh2oA/2x6oang7Qu1nYZFF29ZRD149w4YlVxWBi87 zRs+1oDPAP9E2uUZ134qbwsnBfXLPmGhAUdOMW0fbN85Y2Oz8BFJAQ== =XEbO -----END PGP SIGNATURE----- --=-=-=--