From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Richard Stallman Newsgroups: gmane.emacs.devel Subject: Re: Function vectors: +funvec-20030516-0-c.patch Date: Mon, 17 May 2004 07:04:34 -0400 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: References: <85fzaiakb9.fsf@junk.nocrew.org> <20040503195701.GD21891@fencepost> <85ekpz5twj.fsf@junk.nocrew.org> <874qqiao9o.fsf@tc-1-100.kawasaki.gol.ne.jp> <20040515231754.GB20052@fencepost> <87r7tlggue.fsf_-_@tc-1-100.kawasaki.gol.ne.jp> Reply-To: rms@gnu.org NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1084795064 29132 80.91.224.253 (17 May 2004 11:57:44 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 17 May 2004 11:57:44 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Mon May 17 13:57:39 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BPgkV-0003ys-00 for ; Mon, 17 May 2004 13:57:39 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1BPgkV-0000WQ-00 for ; Mon, 17 May 2004 13:57:39 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1BPgPB-0003Vi-6M for emacs-devel@quimby.gnus.org; Mon, 17 May 2004 07:35:37 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.34) id 1BPgOt-0003VC-Ik for emacs-devel@gnu.org; Mon, 17 May 2004 07:35:19 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.34) id 1BPgOM-0003QX-Lb for emacs-devel@gnu.org; Mon, 17 May 2004 07:35:18 -0400 Original-Received: from [199.232.76.164] (helo=fencepost.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1BPfvG-0008KJ-Ng for emacs-devel@gnu.org; Mon, 17 May 2004 07:04:42 -0400 Original-Received: from rms by fencepost.gnu.org with local (Exim 4.34) id 1BPfv8-0005rD-68; Mon, 17 May 2004 07:04:34 -0400 Original-To: Miles Bader In-reply-to: <87r7tlggue.fsf_-_@tc-1-100.kawasaki.gol.ne.jp> (message from Miles Bader on 16 May 2004 13:02:01 +0900) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:23578 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:23578 Here are comments on the manual text. + For example, @code{(curry 'concat "The ")} returns a function that + when called with string arguments, will in turn call @code{concat} + with @code{"The "} and the string arguments: That's not easy to read. To make it clear, + For example, @code{(curry 'concat "The ")} returns a function that + concatenates @code{"The "} and its arguments. Calling this function + on @code{"end"} returns @code{"The end"}: followed by the same example. + or more usefully, used as a function with @code{mapcar}: Better is The @dfn{curried function} is useful as an argument to @code{mapcar}: + Function currying may be implemented in any lisp by constructing a + @code{lambda} expression, for instance: + + @example + (defun curry (function &rest args) + `(lambda (&rest call-args) + (apply ,function ,@@args call-args))) + @end example I don't think this precise code works reliably in Emacs Lisp. (Lisp should be capitalized.) ! A @dfn{function vector}, or @dfn{funvec}, is a vector-like object ! which is callable as a function. whose purpose is to define special kinds of functions. Like a normal vector, its elements ! can be examined or set using the @code{aref} and @code{aset} ! functions. ! Please avoid passive. A funvec with a list as its first element is a byte-compiled function, ! produced by the byte copmiler; Typo. ! When such a funvec is called, the embedded function is called with an ! argument list composed of the arguments in the funvec followed by the ! arguments the funvec was called with. @xref{Function Currying}. Calling such a funvec operates by calling the embedded function with... ! @defun make-funvec kind num-params ! @code{make-funvec} returns a new function vector containing @var{kind} ! and @var{num-params} more elements (initialized to @code{nil}). Is this function really worth having? Why not use only `funvec'? ! This function cannot be used to make byte-code functions, even though ! they are a sort of funvec --- to do that, use the Our style is no spaces around ---. To say "cannot" is not clear. What does that mean? It gets an error? You should avoid such usage?