From unknown Sun Jun 22 22:42:52 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#22961 <22961@debbugs.gnu.org> To: bug#22961 <22961@debbugs.gnu.org> Subject: Status: The read function does not support a lambda argument Reply-To: bug#22961 <22961@debbugs.gnu.org> Date: Mon, 23 Jun 2025 05:42:52 +0000 retitle 22961 The read function does not support a lambda argument reassign 22961 emacs submitter 22961 Mihai C=C4=83lin Bazon severity 22961 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 09 11:27:11 2016 Received: (at submit) by debbugs.gnu.org; 9 Mar 2016 16:27:11 +0000 Received: from localhost ([127.0.0.1]:41719 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1adgx4-0001dX-UD for submit@debbugs.gnu.org; Wed, 09 Mar 2016 11:27:11 -0500 Received: from eggs.gnu.org ([208.118.235.92]:45587) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1adZcf-0005J3-Lc for submit@debbugs.gnu.org; Wed, 09 Mar 2016 03:37:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1adZcZ-0008EN-N1 for submit@debbugs.gnu.org; Wed, 09 Mar 2016 03:37:32 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, HTML_MESSAGE,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:57137) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1adZcZ-0008E6-JE for submit@debbugs.gnu.org; Wed, 09 Mar 2016 03:37:31 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36553) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1adZcY-0005et-Kb for bug-gnu-emacs@gnu.org; Wed, 09 Mar 2016 03:37:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1adZcX-0008B9-Mm for bug-gnu-emacs@gnu.org; Wed, 09 Mar 2016 03:37:30 -0500 Received: from mail-ig0-x22d.google.com ([2607:f8b0:4001:c05::22d]:35679) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1adZcX-0008AM-Ga for bug-gnu-emacs@gnu.org; Wed, 09 Mar 2016 03:37:29 -0500 Received: by mail-ig0-x22d.google.com with SMTP id vf5so6349993igb.0 for ; Wed, 09 Mar 2016 00:37:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to; bh=MO082kqNwovWBU3nbatCmPFKyCfgCr6ezLlsWw6TfOw=; b=zZT+guhzahtFPGHlrEXZSmsO1mCEmuyrGuuYp7YV9SRmjD+nzn5gQeJJq4/j3pUDbu OSgOUCEH2HrQsWjici87US4qp9OJZ7TmZUecuVSiJwJ/8QJryZOOAjZVhgBqR6yvpYaY FXWuN7V7QKMISSla6AsljrDkxbpQrvygOnF13kP3qHnow4jibFDHWho1nE+0TXHqB79l x4btFYPu/j8IIOTRl+1csgGZ7BZbbEphRI9Ruw/BL39q3G93pIAHG0gbwrS3VxxBU/vd tLoK2lRHW+hzdCe3eN9ami+fUiaXBDRYadGYaIuOn1nNp9AxLPYSsc6CJf9GW0ECzNUh lZ6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to; bh=MO082kqNwovWBU3nbatCmPFKyCfgCr6ezLlsWw6TfOw=; b=DIh5c75u3gQgadq10CakXbvH6KyV4hJ99tsJ0RzTRhHh/Lfoge6xsSxm/nvjhm61op XXF4x5QmOxtjDD5jQjcCIcwYjrk7C61fWDpcQYI4UY+7hyKgEBSpumP8U8YvAPtoo9pv 1/iK6ykseqSFd0G4D62Qgw+kuWClmhsrl9Nhc2NHrnRJqPzGBmdaScYka2+XVp5V6gw1 MZi02mIUBl/jolpZ/ggsESlJrM92obDeV+687nalAsC2OccJMt9C7uUNrJUtPaMT7VbH i5tYpIiCCDwxqBja4CW/yqNOuEwF5eh55+ZGOS6P9rcLtR9ae79nqRKkxblR+n11wHOu NSFg== X-Gm-Message-State: AD7BkJKBpO8UrrT7x63IqUKMg7dXYSUcECI96lAvIHeqY7avnpFwtVagVIUXcwax9NtZqRSQIblaG8ZIpNuwuA== MIME-Version: 1.0 X-Received: by 10.50.50.177 with SMTP id d17mr11171395igo.10.1457512648685; Wed, 09 Mar 2016 00:37:28 -0800 (PST) Received: by 10.107.4.72 with HTTP; Wed, 9 Mar 2016 00:37:28 -0800 (PST) Date: Wed, 9 Mar 2016 10:37:28 +0200 Message-ID: Subject: The read function does not support a lambda argument From: =?UTF-8?Q?Mihai_C=C4=83lin_Bazon?= To: bug-gnu-emacs@gnu.org Content-Type: multipart/alternative; boundary=047d7bdca686ae4177052d999b0d X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Wed, 09 Mar 2016 11:27:10 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) --047d7bdca686ae4177052d999b0d Content-Type: text/plain; charset=UTF-8 Example, I eval this in the scratch buffer (with lexical-binding set true): (read (let ((str "TEST") (pos 0) (prev nil)) (lambda (ch) (cond (ch (push ch prev)) (prev (pop prev)) ((< pos (length str)) (prog1 (aref str pos) (setq pos (1+ pos)))))))) According to the docs [1] an input stream can be a function. I would expect the above to return the symbol TEST, but instead I get an error ("end of file during parsing"). [1] http://www.gnu.org/software/emacs/manual/html_node/elisp/Input-Streams.html#Input-Streams -- Mihai Bazon, http://lisperator.net/ --047d7bdca686ae4177052d999b0d Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: base64 PGRpdiBkaXI9Imx0ciI+PGRpdj5FeGFtcGxlLCBJIGV2YWwgdGhpcyBpbiB0aGUgc2NyYXRjaCBi dWZmZXIgKHdpdGggbGV4aWNhbC1iaW5kaW5nIHNldCB0cnVlKTo8YnI+PGJyPsKgwqDCoCAocmVh ZCAobGV0ICgoc3RyICZxdW90O1RFU1QmcXVvdDspPGJyPsKgwqDCoMKgwqDCoMKgwqDCoMKgwqDC oMKgwqDCoCAocG9zIDApPGJyPsKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoCAocHJldiBu aWwpKTxicj7CoMKgwqDCoMKgwqDCoMKgwqDCoMKgIChsYW1iZGEgKGNoKTxicj7CoMKgwqDCoMKg wqDCoMKgwqDCoMKgwqDCoCAoY29uZDxicj7CoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqAg KGNoIChwdXNoIGNoIHByZXYpKTxicj7CoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqAgKHBy ZXYgKHBvcCBwcmV2KSk8YnI+wqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgICgoJmx0OyBw b3MgKGxlbmd0aCBzdHIpKTxicj7CoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoCAocHJv ZzEgKGFyZWYgc3RyIHBvcyk8YnI+wqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKg IChzZXRxIHBvcyAoMSsgcG9zKSkpKSkpKSk8YnI+PGJyPjwvZGl2PkFjY29yZGluZyB0byB0aGUg ZG9jcyBbMV0gYW4gaW5wdXQgc3RyZWFtIGNhbiBiZSBhIGZ1bmN0aW9uLsKgIEkgd291bGQgZXhw ZWN0IHRoZSBhYm92ZSB0byByZXR1cm4gdGhlIHN5bWJvbCBURVNULCBidXQgaW5zdGVhZCBJIGdl dCBhbiBlcnJvciAoJnF1b3Q7ZW5kIG9mIGZpbGUgZHVyaW5nIHBhcnNpbmcmcXVvdDspLjxicj48 YnI+WzFdIDxhIGhyZWY9Imh0dHA6Ly93d3cuZ251Lm9yZy9zb2Z0d2FyZS9lbWFjcy9tYW51YWwv aHRtbF9ub2RlL2VsaXNwL0lucHV0LVN0cmVhbXMuaHRtbCNJbnB1dC1TdHJlYW1zIj5odHRwOi8v d3d3LmdudS5vcmcvc29mdHdhcmUvZW1hY3MvbWFudWFsL2h0bWxfbm9kZS9lbGlzcC9JbnB1dC1T dHJlYW1zLmh0bWwjSW5wdXQtU3RyZWFtczwvYT48YnIgY2xlYXI9ImFsbCI+PGRpdj48ZGl2Pjxi cj4tLSA8YnI+PGRpdiBjbGFzcz0iZ21haWxfc2lnbmF0dXJlIj5NaWhhaSBCYXpvbiw8YnI+PGEg aHJlZj0iaHR0cDovL2xpc3BlcmF0b3IubmV0LyIgdGFyZ2V0PSJfYmxhbmsiPmh0dHA6Ly9saXNw ZXJhdG9yLm5ldC88L2E+PC9kaXY+DQo8L2Rpdj48L2Rpdj48L2Rpdj4NCg== --047d7bdca686ae4177052d999b0d-- From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 09 13:27:55 2016 Received: (at 22961) by debbugs.gnu.org; 9 Mar 2016 18:27:55 +0000 Received: from localhost ([127.0.0.1]:41786 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1adipv-000682-73 for submit@debbugs.gnu.org; Wed, 09 Mar 2016 13:27:55 -0500 Received: from mail-yk0-f174.google.com ([209.85.160.174]:36561) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1adipt-00067q-IV for 22961@debbugs.gnu.org; Wed, 09 Mar 2016 13:27:53 -0500 Received: by mail-yk0-f174.google.com with SMTP id r203so19218437ykd.3 for <22961@debbugs.gnu.org>; Wed, 09 Mar 2016 10:27:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=noTLQ6OtGfCOCidvRUPG58xx9Ir3TiUfXNIOWakNkoU=; b=m4ZOluKWMNI1p8eQ0lrhGG51UZLbPBGbIAs9v4WyTZthe782DN3DiE6+llGgoj9vsV ZXfnzkmQQynJUa8fx0E67W0M6Wmdq58gBxrThUnZKmcWIrilgW1HM3I//gwYgyeh1OPq wkvT0bH7Hqg5jVY+mlR2TvPGDykMD6wLRhuWwVebHRW8txqP30cCAa6dJbEMZt2b8Pbb S9KtWOss8TbvVOWJ6nAAviVMhXyPHdHqOqDMTG9cq3s/zAnJPgnGlcjFwLotzz45hH0u pnjpwse7EHjsoE06v6N7txwj3NZKTUxL+gb7r2/vFkm9o3vBtcQ8QbZJ33aCcwczoTTv 962g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=noTLQ6OtGfCOCidvRUPG58xx9Ir3TiUfXNIOWakNkoU=; b=mOxKt6qqXOJPaBpSrsu+nWYPhLoKzumNiq5Aq4CBnjvRNxy0VUIB6+0wmUf2ZBv8kX 5civ5bDgeWSx+0N+CZ9+LYccE1bPrdExW7PKTXs5/An3IsvvEuacEtblEtZ36WxOn3C2 VOg83N3tJdZdmuwXGWIA6gUE+K3hMk4a3z43J8FD79QRM1+UM9n2qPsPtd7X5BqMQksq mf9t1aRpTTO56VowzsdnJuD0UMsWOSfIRCnj/2QPheno8eKGXyuf+tFRCipq+MvAnM2z e/uoPipYpmK1c99ZJGswPE7nEaYlwEjWlrJO27rYOnoFUJD51hHhYSsiKOxihVStn5bm 0QuA== X-Gm-Message-State: AD7BkJIaExXxT+DQgwOAPsPG01gXQo+7UQ1keZQCbj4qly6nLzVQZ0RZmPSpDuXxKfoEjyDODAlmddf7a44wFQ== X-Received: by 10.37.92.139 with SMTP id q133mr19839606ybb.118.1457548068208; Wed, 09 Mar 2016 10:27:48 -0800 (PST) MIME-Version: 1.0 Received: by 10.37.66.140 with HTTP; Wed, 9 Mar 2016 10:27:28 -0800 (PST) In-Reply-To: References: From: John Mastro Date: Wed, 9 Mar 2016 10:27:28 -0800 Message-ID: Subject: Re: bug#22961: The read function does not support a lambda argument To: 22961@debbugs.gnu.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 22961 Cc: =?UTF-8?Q?Mihai_C=C4=83lin_Bazon?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Mihai C=C4=83lin Bazon wrote: > Example, I eval this in the scratch buffer (with lexical-binding set true= ): > > (read (let ((str "TEST") > (pos 0) > (prev nil)) > (lambda (ch) > (cond > (ch (push ch prev)) > (prev (pop prev)) > ((< pos (length str)) > (prog1 (aref str pos) > (setq pos (1+ pos)))))))) > > According to the docs [1] an input stream can be a function. I would exp= ect > the above to return the symbol TEST, but instead I get an error ("end of > file during parsing"). Confirmed on Emacs 25. However, it does work with a named defun: (let ((str "TEST") (pos 0) (prev nil)) (defun my-read-function (&optional ch) (cond (ch (push ch prev)) (prev (pop prev)) ((< pos (length str)) (prog1 (elt str pos) (setq pos (1+ pos))))))) (read #'my-read-function) ;=3D> TEST (Mihai, the =E2=80=98ch=E2=80=99 argument should be =E2=80=98&optional=E2= =80=99, though that's not related to the error in question). --=20 john From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 09 13:46:47 2016 Received: (at 22961-done) by debbugs.gnu.org; 9 Mar 2016 18:46:47 +0000 Received: from localhost ([127.0.0.1]:41798 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1adj8B-0006Zo-1K for submit@debbugs.gnu.org; Wed, 09 Mar 2016 13:46:47 -0500 Received: from mail-out.m-online.net ([212.18.0.9]:35682) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1adj88-0006Zf-QR for 22961-done@debbugs.gnu.org; Wed, 09 Mar 2016 13:46:45 -0500 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 3qL2SM4gysz3hjNh; Wed, 9 Mar 2016 19:46:43 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.68]) by mail.m-online.net (Postfix) with ESMTP id 3qL2SM2t0LzvhMg; Wed, 9 Mar 2016 19:46:43 +0100 (CET) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.68]) (amavisd-new, port 10024) with ESMTP id ZU6b2gfJH88q; Wed, 9 Mar 2016 19:46:42 +0100 (CET) X-Auth-Info: qQ/KECHA2EwPe0bZ5WBHZG1nvuQ5otK4XJyH+bdSJahdNT4sEkYwg/IEFHVfFKuU Received: from igel.home (ppp-88-217-13-150.dynamic.mnet-online.de [88.217.13.150]) by mail.mnet-online.de (Postfix) with ESMTPA; Wed, 9 Mar 2016 19:46:42 +0100 (CET) Received: by igel.home (Postfix, from userid 1000) id 18CFD2C371A; Wed, 9 Mar 2016 19:46:42 +0100 (CET) From: Andreas Schwab To: Mihai =?utf-8?Q?C=C4=83lin?= Bazon Subject: Re: bug#22961: The read function does not support a lambda argument References: X-Yow: I'm in ATLANTIC CITY riding in a comfortable ROLLING CHAIR... Date: Wed, 09 Mar 2016 19:46:41 +0100 In-Reply-To: ("Mihai =?utf-8?Q?C=C4=83lin?= Bazon"'s message of "Wed, 9 Mar 2016 10:37:28 +0200") Message-ID: <87y49ro5f2.fsf@linux-m68k.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 22961-done Cc: 22961-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Should be fixed in commit 711ca36. Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 09 15:31:54 2016 Received: (at 22961) by debbugs.gnu.org; 9 Mar 2016 20:31:54 +0000 Received: from localhost ([127.0.0.1]:41851 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1adklu-0000Z2-Dp for submit@debbugs.gnu.org; Wed, 09 Mar 2016 15:31:54 -0500 Received: from mail-oi0-f52.google.com ([209.85.218.52]:33159) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1adkls-0000Yp-Fn for 22961@debbugs.gnu.org; Wed, 09 Mar 2016 15:31:52 -0500 Received: by mail-oi0-f52.google.com with SMTP id d205so45085263oia.0 for <22961@debbugs.gnu.org>; Wed, 09 Mar 2016 12:31:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:cc; bh=dyJ04xH2QKNYcRl6QBn/XYIXN9u3mrzTuJzXPbx4FMk=; b=u13Bv4KgFRyd238ROzEJUVJP89eM6AjugnIP9vM/mLPUAhkPU8XFHoMbBuIlC1IZ+p oGmChoWzpRFK2GNLRW4ItRl2z9bNyFFIikM8yipBEI4SwGjFNATCHYmATMoLJYRh+t+T hoAYGr64EnurZw3nLJkQkPc3V65CWnUzh7JpNbpAKWrGmh39+VLGLCp9I/EnBzjfZ7yg XptzJr7X+xpO5fzYgosnfEHuvqQMJ0YlIuxHemAe9oiWCEjDb8sQjfBE9JnELSluZa+z 2z+abBdMOCFPjFqXlFbw3A2RjVDjGczV/U+bdljgyKmmZamUwwBMj+GN/ZvxwEyEQuKX 4wQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=dyJ04xH2QKNYcRl6QBn/XYIXN9u3mrzTuJzXPbx4FMk=; b=hVrvMKcvssU4O13rYQFyLIIpg1JAAIkEfsgwzLQF+1srPCWG3130Ygp5W1GLk95ZiG WwpvWLUgITVJQR9U+7/Vl8o6NUM+hQjimGgYd5cB9jvnz8nhQ01r7xD2c9sDGAIO1Zc7 4SAJuRVPjMBGDUzojRkaA/iSrRf+r1wEQ570QRfTe57Tn1xJQ0wEXfHbsHyOd/D1Oa2O BAMmUSH4y8921miWHPXC91I+8AQAtwBvm7FBGUzeP8YsZJqRSUIUkbKP9fLm9CaN6CzZ kWSY75I66Asq1VdKn8U6t+NswJywanLt84BVmqW+OX0JQu0xMckQwYfC3ntdpSBfTHYN f0GQ== X-Gm-Message-State: AD7BkJJhfEwZ3mbi+owmHdwfFk2rn2OXZJdzeApF+CNVK3M8AcmDuwEWz1HeDOPoxz0wS5/NJcW+xjN19aHOFg== X-Received: by 10.202.185.214 with SMTP id j205mr138025oif.68.1457555506606; Wed, 09 Mar 2016 12:31:46 -0800 (PST) MIME-Version: 1.0 Received: by 10.202.172.198 with HTTP; Wed, 9 Mar 2016 12:31:07 -0800 (PST) From: Kaushal Modi Date: Wed, 9 Mar 2016 15:31:07 -0500 Message-ID: Subject: The read function does not support a lambda argument To: 22961@debbugs.gnu.org, mihai.bazon@gmail.com Content-Type: multipart/alternative; boundary=001a113cd1fa36414b052da39696 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 22961 Cc: John Mastro , Andreas Schwab X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --001a113cd1fa36414b052da39696 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I just re-built using this commit ( http://git.savannah.gnu.org/cgit/emacs.git/commit/?h=3Demacs-25&id=3D711ca3= 62e7f8ca7c4f664dc2fe60bc5fa4e4f4fe ). Now the earlier error went away, but I get Symbol=E2=80=99s value as variable is void: prev I guess the read call should be inside the let: (let ((str "TEST") (pos 0) (prev nil)) (read (lambda (&optional ch) (cond (ch (push ch prev)) (prev (pop prev)) ((< pos (length str)) (prog1 (aref str pos) (setq pos (1+ pos)))))))) Above returns "TEST". --001a113cd1fa36414b052da39696 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

Now the earlier error went away, but I g= et=C2=A0

=C2=A0=C2=A0Symbol=E2=80=99s value as var= iable is void: prev

I guess the read call should b= e inside the let:

(let ((str "TEST"= )
=C2=A0 =C2=A0 =C2=A0 (pos 0)
=C2=A0 =C2=A0 =C2=A0 (pr= ev nil))
=C2=A0 (read (lambda (&optional ch)
=C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 (cond
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0(ch (push ch prev))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0(prev (pop prev))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0((< pos (length str))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 (prog1 (aref str pos)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 (setq pos (1+ pos))))))))

Abov= e returns "TEST".
--001a113cd1fa36414b052da39696-- From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 09 16:10:47 2016 Received: (at 22961) by debbugs.gnu.org; 9 Mar 2016 21:10:47 +0000 Received: from localhost ([127.0.0.1]:41888 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1adlNX-0001TP-1v for submit@debbugs.gnu.org; Wed, 09 Mar 2016 16:10:47 -0500 Received: from mail-io0-f176.google.com ([209.85.223.176]:35916) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1adlNU-0001TB-P3 for 22961@debbugs.gnu.org; Wed, 09 Mar 2016 16:10:45 -0500 Received: by mail-io0-f176.google.com with SMTP id z76so81942191iof.3 for <22961@debbugs.gnu.org>; Wed, 09 Mar 2016 13:10:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=q4jAbX0S7WGsjOz1Wke0p8gzfMrxmgiQzKBHUIaH+jk=; b=mS+M/Ndn1Cbx8HObvWtQkEWQ+nwG/qOPXegKV5y7wXE6PRcE41EHVvF8ld0oUVhgjE 8YTkxDyMWlDb0dgJIRmhcoW7CltqOgMhPwfIvRsIMJIbUTG7t2ZaYm+kXjokm/iDf08j RbmIMXcyc6or1pgytrw+vH1KjYMODldn22+dlcAcjTZTi21TZnltxn8IfLPieino1F5p 6whYKwsXvTHVNxWYNcYufRyTGFB9iAfm2fSXlpLGxT+DIiFJrv/K0/7BCpYEbWa62H1b XBVaFGBnp7f8vzI5Husd280Y5VE+Ei4Rs88j+zt0tj7DMeaWFMmWPY+PQ+0Xd4kT1Ng+ 6SBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=q4jAbX0S7WGsjOz1Wke0p8gzfMrxmgiQzKBHUIaH+jk=; b=YU+zodFLt2RMoUqW57LvyxyDI9Y32jqG2ZJ5ThUqbYLBnhXJLys1mD9p+SST2u/b3G Dneqe8IWHKWSjOD06v8zVziVpafk87vq53Ul6PhZH1Doir7WtthrJojHHxKsM0dmCCz0 8ckf4z4H0gx+TUne3nisChhRGjJHKe4fqhRPrMNCqYQDJh4Jun5Azbjxy6J3Kb98rrgl CLLy0p6PfCLcLv2QHVQPgatSOkYf786am20gs1VvkXsPF2XNLphvCU8OomyS7ofdmMXI igXzc54FN02cC3n0AgbB69XVumixTTKQ+SmikIXFhQvWMrkZgLkU7IsouEE2ETiR+b69 SFAg== X-Gm-Message-State: AD7BkJLMCgam7QmOwudhYe6PJVenxvfYqi/bbR6TR9k/Icuv8H12NJ+ESplCuIHeCRH2PkVCbkgBJVNPbibeew== MIME-Version: 1.0 X-Received: by 10.107.161.206 with SMTP id k197mr1315348ioe.139.1457557839260; Wed, 09 Mar 2016 13:10:39 -0800 (PST) Received: by 10.107.4.72 with HTTP; Wed, 9 Mar 2016 13:10:39 -0800 (PST) In-Reply-To: References: Date: Wed, 9 Mar 2016 23:10:39 +0200 Message-ID: Subject: Re: The read function does not support a lambda argument From: =?UTF-8?Q?Mihai_C=C4=83lin_Bazon?= To: Kaushal Modi Content-Type: multipart/alternative; boundary=001a1140f9883ff1e9052da4214f X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 22961 Cc: John Mastro , Andreas Schwab , 22961@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --001a1140f9883ff1e9052da4214f Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable You should (setq lexical-binding t) before running it (and note that's buffer-local, I've been bitten by that several times). With lexical binding my original example should work (with the fix, as John pointed out, that the argument should be &optional). Thanks Andreas for the quick fix! :-) On Wed, Mar 9, 2016 at 10:31 PM, Kaushal Modi wrote: > I just re-built using this commit ( > http://git.savannah.gnu.org/cgit/emacs.git/commit/?h=3Demacs-25&id=3D711c= a362e7f8ca7c4f664dc2fe60bc5fa4e4f4fe > ). > > Now the earlier error went away, but I get > > Symbol=E2=80=99s value as variable is void: prev > > I guess the read call should be inside the let: > > (let ((str "TEST") > (pos 0) > (prev nil)) > (read (lambda (&optional ch) > (cond > (ch (push ch prev)) > (prev (pop prev)) > ((< pos (length str)) > (prog1 (aref str pos) > (setq pos (1+ pos)))))))) > > Above returns "TEST". > --=20 Mihai Bazon, http://lisperator.net/ --001a1140f9883ff1e9052da4214f Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
You should (setq lexical-binding t) before runni= ng it (and note that's buffer-local, I've been bitten by that sever= al times).=C2=A0 With lexical binding my original example should work (with= the fix, as John pointed out, that the argument should be &optional).<= br>

Thanks Andreas for the quick fix! :-)

On Wed, Mar 9, 2016 at 10:= 31 PM, Kaushal Modi <kaushal.modi@gmail.com> wrote:
=

Now the earlier error went away, but I get=C2=A0

=C2=A0=C2=A0Symbol=E2=80=99s value as variable is void: prev
<= div>
I guess the read call should be inside the let:

(let ((str "TEST")
=C2=A0 =C2=A0 = =C2=A0 (pos 0)
=C2=A0 =C2=A0 =C2=A0 (prev nil))
=C2=A0 = (read (lambda (&optional ch)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 (cond
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(ch (push ch p= rev))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(prev (pop prev))<= /div>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0((< pos (length str))=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (prog1 (aref str pos)<= /div>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (setq pos (1+ po= s))))))))

Above returns "TEST".



--
--001a1140f9883ff1e9052da4214f-- From unknown Sun Jun 22 22:42:52 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 07 Apr 2016 11:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator