From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Newsgroups: gmane.emacs.help Subject: Re: Function returning a list Date: Sat, 19 Dec 2020 10:04:58 +0100 Message-ID: <20201219090458.GB20010@tuxteam.de> References: Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="GRPZ8SYKNexpdSJ7" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14305"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mutt/1.5.21 (2010-09-15) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sat Dec 19 10:30:09 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 1kqYYz-0003dI-Jb for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 19 Dec 2020 10:30:09 +0100 Original-Received: from localhost ([::1]:48486 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kqYYy-0006mv-K5 for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 19 Dec 2020 04:30:08 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38470) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kqYYE-0006mp-2K for help-gnu-emacs@gnu.org; Sat, 19 Dec 2020 04:29:22 -0500 Original-Received: from mail.tuxteam.de ([5.199.139.25]:41158) by eggs.gnu.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.90_1) (envelope-from ) id 1kqYYA-0003Lc-Ab for help-gnu-emacs@gnu.org; Sat, 19 Dec 2020 04:29:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tuxteam.de; s=mail; h=From:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:To:Date; bh=3RjVRWWddFDs4rgXdhY4H9qxD/RPNoMq6Abg45yPjJs=; b=ELY+0eiZ0Z6LUadlGnie4zR414XhQhT+jvpukcwhNl7Wmxw5AJfR07iyKi6cGtT0vAO1adTWw0yrJJuHqXTzD/5/qreBxHD/+Ou5wiMl62DKzqA/4FqQk0xXkAAdY4d7pUzCxxeabnmgMX3Wg8AFqhUI91QAzrbP89Mv+qWSuFUCCQmwQSbVp8Ac46EcTD6wiDhdMad0wSSYGsYXyU6XeYbegPyFpVCJzz1f/9aF7tp2n7BQ73wybmZIAa9n2K474yZ0AW3DMTnh0vL/iVz0gn1mcUfEaRLXxgcWWODV3jPqdqOc5vkg3vMLlA4c8Wys9Io7jQ3UqT6fMMAc1MtG9w==; Original-Received: from tomas by mail.tuxteam.de with local (Exim 4.80) (envelope-from ) id 1kqYAc-0005SX-4Y for help-gnu-emacs@gnu.org; Sat, 19 Dec 2020 10:04:58 +0100 Content-Disposition: inline In-Reply-To: Received-SPF: pass client-ip=5.199.139.25; envelope-from=tomas@tuxteam.de; helo=mail.tuxteam.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, 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:126566 Archived-At: --GRPZ8SYKNexpdSJ7 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Dec 19, 2020 at 01:34:45AM +0100, steve-humphreys@gmx.com wrote: >=20 > I have a function "timgrid" that returns a list. But the list returned > 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) =2E.. 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 --GRPZ8SYKNexpdSJ7 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAl/dwjoACgkQBcgs9XrR2kZ4TACfWvhYzAnANIhiep6NmkCY0z8N n9oAnRgVE9Jywthlw0bIilySdoYpXNF3 =ne7h -----END PGP SIGNATURE----- --GRPZ8SYKNexpdSJ7--