From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: fatiparty--- via Users list for the GNU Emacs text editor Newsgroups: gmane.emacs.help Subject: Elisp function that performs numeric computations Date: Fri, 21 Jan 2022 13:25:55 +0100 (CET) Message-ID: References: <87czkoezg4.fsf@mbork.pl> <87sfthtigj.fsf@zoho.eu> Reply-To: fatiparty@tutanota.com Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29870"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Help Gnu Emacs To: Emanuel Berg Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jan 21 14:34:51 2022 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 1nAu42-0007YI-SY for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 21 Jan 2022 14:34:51 +0100 Original-Received: from localhost ([::1]:58234 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nAu41-000517-ME for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 21 Jan 2022 08:34:49 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:51046) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nAszP-000344-PX for help-gnu-emacs@gnu.org; Fri, 21 Jan 2022 07:26:02 -0500 Original-Received: from w1.tutanota.de ([81.3.6.162]:53564) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nAszN-0001pt-JE for help-gnu-emacs@gnu.org; Fri, 21 Jan 2022 07:25:59 -0500 Original-Received: from w3.tutanota.de (unknown [192.168.1.164]) by w1.tutanota.de (Postfix) with ESMTP id 5F944FBF809; Fri, 21 Jan 2022 12:25:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1642767955; s=s1; d=tutanota.com; h=From:From:To:To:Subject:Subject:Content-Description:Content-ID:Content-Type:Content-Type:Content-Transfer-Encoding:Content-Transfer-Encoding:Cc:Cc:Date:Date:In-Reply-To:In-Reply-To:MIME-Version:MIME-Version:Message-ID:Message-ID:Reply-To:References:References:Sender; bh=Ign4FK4zGUaQ1kyOWpA7qnpbPtfu2oXSRZPp3YzivOY=; b=w1iOkgkrGXddoqI2mUNC+mgUreauWrgMk4MeoCRqH6UbGPphqz+w8a/KwESFaMC/ lZmC7X8nWsMkANRLNBqTGaguVFY3KKtq2CjwdK09jQrlWWTXvFFGrhjLZAX3uSeu344 NTb7EdaV3Xs39Gd5Lj2M8yYrAkhW6OLxrUSnxntJ73nAHqknhFTZ2T+uLyBuoR5M3sZ 6z3Cjxq/m+ZSC5gvTHXlHIisyzWJXd9b9P7lFDp65nhLYsGy/vsCqJAZEPIcn378UDD mjQS7ry2JirubW1H6dNq3DwiJW1AOxdf5LdPDD7wyOjK0voU88FF06H6/0EO/L3mM9+ VD0Q/v29mw== In-Reply-To: <87sfthtigj.fsf@zoho.eu> Received-SPF: pass client-ip=81.3.6.162; envelope-from=fatiparty@tutanota.com; helo=w1.tutanota.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-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" Xref: news.gmane.io gmane.emacs.help:135474 Archived-At: Jan 21, 2022, 23:51 by help-gnu-emacs@gnu.org: > fatiparty--- via Users list for the GNU Emacs text editor wrote: > >> (defun test (dcur dmax drpt) >> > > All programming: Name the function something that etc etc. > > Lisp: We don't name formal parameters the assembly language or > C style ... give them short, but if possible complete names > that are easy to read and write. When in doubt, give them > a complete name that communicates what its purpose or > intended use. > >> "Compute brace depth used for brace colouring." >> > > Doc string should have the formal parameter's names in BOLD in > the order they come in the the function definition ... > >> (interactive) >> > > Assign the formal parameters with argument values > > (interactive "ndepth: \nntop: \nnrepeat: ") > ^ eval me > > Use English in the prompt string, if the words feel to long > see if they can be shortened in a natural way (here, e.g. dep, > top, and rep) - the reason one avoids "max" is it also appears > in as the function `max' ... > >> (let ( (n dcur) ) >> (message "dcur <=3D dmax | Typeface: %d" n) >> n) >> > > If there is no computation, renaming it ... why do you > do that? > I did that because I use n an the output (either it is dcur [current depth]= or it is from the latter computation). But as you say, I could just do (if (<=3D dcur dmax)=C2=A0 =C2=A0=C2=A0=C2=A0 dcur (let* ( (j drpt) ... > You use it like this: > > (let*((side 2) > (square (expt side 2) )) ... > ;; use square here > ) > > --=20 > underground experts united > https://dataswamp.org/~incal >