emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Function vectors: +funvec-20030516-0-c.patch


From: Richard Stallman
Subject: Re: Function vectors: +funvec-20030516-0-c.patch
Date: Mon, 17 May 2004 07:04:34 -0400

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?





reply via email to

[Prev in Thread] Current Thread [Next in Thread]