From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: steve-humphreys@gmx.com Newsgroups: gmane.emacs.help Subject: Re: Function returning a list Date: Sat, 19 Dec 2020 10:39:39 +0100 Message-ID: References: <20201219090458.GB20010@tuxteam.de> 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="16536"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs@gnu.org To: tomas@tuxteam.de Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sat Dec 19 10:40:16 2020 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 1kqYim-0004Ct-8I for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 19 Dec 2020 10:40:16 +0100 Original-Received: from localhost ([::1]:50050 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kqYil-0007r6-AN for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 19 Dec 2020 04:40:15 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39602) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kqYiM-0007qx-Ka for help-gnu-emacs@gnu.org; Sat, 19 Dec 2020 04:39:50 -0500 Original-Received: from mout.gmx.net ([212.227.15.18]:46655) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kqYiI-0006kf-NK for help-gnu-emacs@gnu.org; Sat, 19 Dec 2020 04:39:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1608370779; bh=VuyP8WwCWlVKjIThgOzEtfK51qLZIRnBNi0d1AL50gs=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=I9SyekiWQro7roVeegx45LKl2fXnqhoE7AcbXLuh0nsBEZ2qBa33kuAA1Eijf6AHX exUxMh3oQsNIYWY56GZFEMugKJ3VfthsxpRbormPcdM6rCN8APx0lXwLufknHJE49m fZej7Jf/mjh1AuYDUpMvNbnWJ6UZrYmTBOghEQ9w= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from [213.165.168.94] ([213.165.168.94]) by web-mail.gmx.net (3c-app-mailcom-bs06.server.lan [172.19.170.174]) (via HTTP); Sat, 19 Dec 2020 10:39:39 +0100 Importance: normal Sensitivity: Normal In-Reply-To: <20201219090458.GB20010@tuxteam.de> X-UI-Message-Type: mail X-Priority: 3 X-Provags-ID: V03:K1:h353aAIj9qkVD+ULWrkp180rMSn/L2Ee7N8RtX5J8h7Oi0qfKcv4ry2PBP9TYLnUBu9p0 UX5c61XMN8TrtRYkjOZ96bnO9yFb5f1VhxdMs/ALEZb/MhpMA7ftc7pOQofRLrNJAfmxbV2mLvxz t97R8mUSnO0rbX7m7AAUd6+3B74Q1chgoMyj/t18kOittjinhWb0oBuNH20w54HxYLDHomKeTwo4 08wj/7QH1OxRcBKbNfjklREHWhImfZ1tAt2FRNHkYdiRMeooaA58C2cRwA4mTkTv09TgVBijmE1R RY= X-UI-Out-Filterresults: notjunk:1;V03:K0:frqY8jhsmlU=:b0NoFubN+EdaV0pN0l3dLx 7YR6nIjlLG0bdFHFYRA6v/J8uIsCD6uMMdE7grt6CbTedwSxcL/h/izHEoBxw+9UWoVWYirul h8Molkpk3WQ6BiSIQuQC/UdPTIQVmLe2bbe9EEaJhMPAhJ4/oqmBITby+1n5kboGNfyejwUuB E9l/Y1p0CT5M7Z3b0JsY4BDzxY+F8Vy5DIza9hJj3NtQLeyi6wkGvxDUAyrRUVJEzXqgmksZs pIb6p6Gsq3i6YvPQcrbeYkIXnGo6sC4bnLnfVxS1lfGGULsVtzS46tCqWWsVTlUofH+ty6fZg rMkAu6T9TzV81X80nvjMHhtvgvkJaPoFazs20YYifh/odPuDl3uTEQgQB2Wa5V1PEZte70uh+ +sCIWDO8fU5JX1pB8I5d9uIdumF6VbVM0SffL69sLBNuUlKuaT/kiefAWnQSmX04g02dneHz5 43CjhgSaPb9/6TGjeZ17m2Z8mn0+7jOVJmx2x36BiAmHU5LHrkLGvHqhNUxDjsgusKHuCmXnR bXFxrj+W4fvuNkx/bcksu50nRFtoc0s6z0ptw8JWtYk8QSpDkOO0WCYqLFBV0QM39ODtCUYuH aUBCaw1OODA1M= Received-SPF: pass client-ip=212.227.15.18; envelope-from=steve-humphreys@gmx.com; helo=mout.gmx.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-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.23 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:126567 Archived-At: I discovered that I was updating the next value in the list, but storing it inside a let, so the list continued putting the same value. And yes, I made a mistake by calling it as math notation. Must have been an old flashback from korea. > Sent: Saturday, December 19, 2020 at 2:34 PM > From: tomas@tuxteam.de > To: help-gnu-emacs@gnu.org > Subject: Re: Function returning a list > > On Sat, Dec 19, 2020 at 01:34:45AM +0100, steve-humphreys@gmx.com wrote: > > > > I have a function "timgrid" that returns a list. But the list returne= d > > by "timgrid-half" got problem in the values. The output for "tgl" is > > also problematic. > > Steve, > > if you want to give us half a chance to help out, you should try to > be a bit more specific. > > What does it mean that a list "got problem in the values"? Surely > the list doesn't mind. Perhaps you don't like the values in the > list. But then, we'd like to know: > > - what values are there > - what values you expect to be there > - how those values were produced, and (ideally) > - your mental model of the above process. > > Now let me label those two code snippets: > > [A] > > (defun timgrid-half (ta tb tpab tc td tpcd) > > (timgrid (ta tb tpab)) ) > > [B] > > (setq tgl (typh-timgrid-half 800 1100 34 1300 1600 21)) > > I don't know what they are trying to do -- but there is at least > one error. In [A], second line, you say: > > [A1] (timgrid (ta tb tpab)) > > which in Lisp means: > > [A1.1] (ta tb tpab) =3D=3D apply function `ta' to the args `tp' and > `tpab' > [A1.2] (timgrid ...) =3D=3D apply function `timgrid' to the above > result > > BUT... according to [B], you pass the value 800 for ta in the > call. Now 800 is not a function (at least not in our little world > of Elisp). So Emacs complains with something like: > > Debugger entered--Lisp error: (invalid-function 800) > (800 1100 34) > (progn (800 1100 34)) > eval((progn (800 1100 34)) t) > elisp--eval-last-sexp(nil) > eval-last-sexp(nil) > funcall-interactively(eval-last-sexp nil) > call-interactively(eval-last-sexp nil nil) > command-execute(eval-last-sexp) > > ... and it is right: 800 ain't a function. > > (Hint: if you see such an error message, fight the first reaction. > Don't panic. Elisp is trying to tell you something. Try to understand > it. Copy snippets of it to include them next time you ask for help. > Next error will be easier). > > I have a hunch that you got confused with the traditional math notation > "f(x)" to apply function f to arg(list) x and Lisp notation (f x) for > (eh -- roughly) the same. > > But you keep so tight-lipped about whatever is happening behind your > Internet socket that I can only guess :-) > > HTH > - t >