From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.bugs Subject: bug#16238: 24.3.50; pcase docs (and possibly pcase) wrong Date: Tue, 24 Dec 2013 10:13:50 +0100 Message-ID: <87ob46vcfl.fsf@thinkpad.tsdh.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1387876515 8074 80.91.229.3 (24 Dec 2013 09:15:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 24 Dec 2013 09:15:15 +0000 (UTC) To: 16238@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Dec 24 10:15:21 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VvO5A-00085D-Cl for geb-bug-gnu-emacs@m.gmane.org; Tue, 24 Dec 2013 10:15:20 +0100 Original-Received: from localhost ([::1]:37148 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VvO59-0002ab-74 for geb-bug-gnu-emacs@m.gmane.org; Tue, 24 Dec 2013 04:15:19 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40241) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VvO4z-0002aR-JU for bug-gnu-emacs@gnu.org; Tue, 24 Dec 2013 04:15:15 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VvO4t-0008Bl-F0 for bug-gnu-emacs@gnu.org; Tue, 24 Dec 2013 04:15:09 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:51925) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VvO4t-0008Am-Bp for bug-gnu-emacs@gnu.org; Tue, 24 Dec 2013 04:15:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VvO4s-0005US-RN for bug-gnu-emacs@gnu.org; Tue, 24 Dec 2013 04:15:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Tassilo Horn Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 24 Dec 2013 09:15:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 16238 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.138787645421009 (code B ref -1); Tue, 24 Dec 2013 09:15:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 24 Dec 2013 09:14:14 +0000 Original-Received: from localhost ([127.0.0.1]:37710 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VvO45-0005Sm-KF for submit@debbugs.gnu.org; Tue, 24 Dec 2013 04:14:14 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:38421) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VvO42-0005Sd-Mm for submit@debbugs.gnu.org; Tue, 24 Dec 2013 04:14:11 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VvO3w-0007zj-AU for submit@debbugs.gnu.org; Tue, 24 Dec 2013 04:14:10 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:57680) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VvO3w-0007zf-7H for submit@debbugs.gnu.org; Tue, 24 Dec 2013 04:14:04 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40117) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VvO3q-0002PK-JP for bug-gnu-emacs@gnu.org; Tue, 24 Dec 2013 04:14:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VvO3l-0007xZ-1q for bug-gnu-emacs@gnu.org; Tue, 24 Dec 2013 04:13:58 -0500 Original-Received: from out3-smtp.messagingengine.com ([66.111.4.27]:34419) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VvO3k-0007xV-Pd for bug-gnu-emacs@gnu.org; Tue, 24 Dec 2013 04:13:52 -0500 Original-Received: from compute2.internal (compute2.nyi.mail.srv.osa [10.202.2.42]) by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id 47F93207E9 for ; Tue, 24 Dec 2013 04:13:52 -0500 (EST) Original-Received: from frontend1 ([10.202.2.160]) by compute2.internal (MEProxy); Tue, 24 Dec 2013 04:13:52 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=from:to:subject:date:message-id :mime-version:content-type; s=smtpout; bh=0FdKBifrOzOtz/R3rxGsU7 waT7M=; b=mzh2YgoIJfJBqhbKuUQb801NiODeoZ3XafWrNsiTvb3n1+w1I6S9lq A6keXFYg9zetM5zdPTeWKdeNCG/2xlJdnyXej1PB1GKe7rkMT7WWCelhq4es8Xvo 7L5AqoD6ciZngYcJ9c5BTJY2vYwT2/wYBck0imnxkLilKCHNYUXi0= X-Sasl-enc: 1JlAnj3FcQdrEfODg2t5hl1D3y+qqSTFNEM0jY6+Lrdv 1387876431 Original-Received: from thinkpad.tsdh.org (unknown [91.67.164.26]) by mail.messagingengine.com (Postfix) with ESMTPA id D0760C00E80 for ; Tue, 24 Dec 2013 04:13:51 -0500 (EST) User-Agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:82504 Archived-At: I'm just reading through the `pcase' docs in the info manual. The simple expression language example has a small bug. The `env' parameter is missing at the location marked below: --8<---------------cut here---------------start------------->8--- (defun evaluate (exp env) (pcase exp (`(add ,x ,y) (+ (evaluate x env) (evaluate y env))) (`(call ,fun ,arg) (funcall (evaluate fun) (evaluate arg env))) `--- HERE! (`(fn ,arg ,body) (lambda (val) (evaluate body (cons (cons arg val) env)))) ((pred numberp) exp) ((pred symbolp) (cdr (assq exp env))) (_ (error "Unknown expression %S" exp)))) --8<---------------cut here---------------end--------------->8--- But even then, I can't get `fn' forms working: ELISP> (evaluate '(fn x (add 1 x)) nil) (lambda (val) (evaluate body (cons (cons arg val) env))) But shouldn't `arg' be substituted with 'x and `body' with '(add 1 x)? Now when I call the function, I get a void-variable error whereas I should get 3: ELISP> (evaluate '(call (fn x (add 1 x)) 2) nil) *** Eval error *** Symbol's value as variable is void: body Strange enough, the `call' pattern which uses the same pattern syntax seems to work, though: ELISP> (evaluate '(call foo 2) '((foo . (lambda (x) (+ 1 x))))) 3 (#o3, #x3, ?\C-c) In any case, it would be good if the docs would contain a sample program defined in the simple expression language. Getting the syntax right just from the patterns is not enough. For example, it's not obvious that `fn' forms take only one symbol as `arg' whereas you'd usually expect an argument list (which might be restricted to length 1). In GNU Emacs 24.3.50.2 (x86_64-pc-linux-gnu, GTK+ Version 3.8.7) of 2013-12-22 on thinkpad Bzr revision: eliz@gnu.org-20131222183138-zlzn9zzpz1hwd110 Windowing system distributor `The X.Org Foundation', version 11.0.11499904 System Description: NAME=Gentoo Configured using: `configure --prefix=/usr --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --libdir=/usr/lib64 --disable-silent-rules --disable-dependency-tracking --program-suffix=-emacs-24-vcs --infodir=/usr/share/info/emacs-24-vcs --enable-locallisppath=/etc/emacs:/usr/share/emacs/site-lisp --with-gameuser=games --without-compress-info --with-file-notification=gfile --disable-acl --with-dbus --with-gnutls --with-gpm --without-hesiod --without-kerberos --without-kerberos5 --with-xml2 --without-selinux --without-wide-int --with-zlib --with-sound=alsa --with-x --without-ns --without-gconf --with-gsettings --with-toolkit-scroll-bars --with-gif --with-jpeg --with-png --with-rsvg --with-tiff --with-xpm --with-imagemagick --with-xft --with-libotf --with-m17n-flt --with-x-toolkit=gtk3 GENTOO_PACKAGE=app-editors/emacs-vcs-24.3.9999 EBZR_BRANCH=trunk EBZR_REVNO=115696 'CFLAGS=-march=native -pipe -g3 -ggdb' CPPFLAGS= 'LDFLAGS=-Wl,-O1 -Wl,--as-needed'' Important settings: value of $LC_COLLATE: C value of $LC_MONETARY: de_DE.utf8 value of $LC_NUMERIC: de_DE.utf8 value of $LC_TIME: de_DE.utf8 value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: helm-match-plugin-mode: t helm-occur-match-plugin-mode: t highlight-parentheses-mode: t global-company-mode: t company-mode: t eldoc-mode: t shell-dirtrack-mode: t paredit-mode: t highlight-symbol-mode: t global-edit-server-edit-mode: t outline-minor-mode: t recentf-mode: t global-subword-mode: t subword-mode: t savehist-mode: t show-paren-mode: t icomplete-mode: t minibuffer-depth-indicate-mode: t tooltip-mode: t electric-pair-mode: t electric-indent-mode: t mouse-wheel-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t column-number-mode: t line-number-mode: t transient-mark-mode: t