The home of Mikael Jansson, hacker, hobby chef & adrenaline junkie based in Sweden. More…

Mikael Jansson.be » Hacking

Milestone 0.4

hypertags

0 / 2

lisp mode

0 / 1

HyperTags (Vim help file conversion of the Hyperspec).

Proposed format (roughly) as follows.

                                                                       *append*
append &rest {lists} => {result}
  {list}   each must be a |cl-proper-list| except the last, which
           may be any |cl-object|.
  {result} an |cl-object|. This will be a |cl-list| unless the last
           list was not a cl-list and all preceding lists were
           |cl-null|.

  Description:
    |append| returns a new list that is the concatenation of the
    copies. lists are left unchanged; the list structure of each
    of lists except the last is copied.  The last argument is not
    copied; it becomes the |cl-cdr| of the final |cl-dotted-pair| of
    the concatenation of the preceding lists, or is returned directly
    if there are no preceding |cl-non-empty| lists.

  Examples:
    (append '(a b c) '(d e f) '() '(g)) =>  (A B C D E F G)
    (append '(a b c) 'd) =>  (A B C . D)
    (setq lst '(a b c)) =>  (A B C)
    (append lst '(d)) =>  (A B C D)
    lst =>  (A B C)
    (append) =>  NIL
    (append 'a) =>  A

  See Also:
    |nconc|, |concatenate|

                                                                        *apply*
apply {function} &rest {args}+ => {result}*
  {function} a |cl-function-designator|
  {args}     a |cl-spreadable-argument-list-designator|
  {results}  the |cl-values| returned by function.

  Description:
    |cl-apply| the function to the args.
    When the function receives its arguments via &rest, it is
    permissible (but not required) for the |cl-implementation|
    to |cl-bind| the |cl-rest-parameter| to an |cl-object|
    that shares structure with the last argument to
    |apply|. Because a |cl-function| can neither detect whether it was
    called via apply nor whether (if so) the last argument to
    apply was a |cl-constant|,
    |cl-conforming-programs| must neither rely on the |cl-list|
    structure of a |cl-rest-list| to be freshly consed, nor modify
    that list structure.  |setf| can be used with apply in
    certain circumstances; see |cl-apply-forms-as-places|.

  Examples:
    (setq f '+) =>  +
    (apply f '(1 2)) =>  3
    (setq f #'-) =>  #<FUNCTION ->
    (apply f '(1 2)) =>  -1
    (apply #'max 3 5 '(2 7 3)) =>  7
    (apply 'cons '((+ 2 3) 4)) =>  ((+ 2 3) . 4)
    (apply #'+ '()) =>  0

    (defparameter *some-list* '(a b c))
    (defun strange-test (&rest x) (eq x *some-list*))
    (apply #'strange-test *some-list*) =>  implementation-dependent

    (defun bad-boy (&rest x) (rplacd x 'y))
    (bad-boy 'a 'b 'c) has undefined consequences.
    (apply #'bad-boy *some-list*) has undefined consequences.

    (defun foo (size &rest keys &key double &allow-other-keys)
      (let ((v (apply #'make-array size :allow-other-keys t keys)))
        (if double (concatenate (type-of v) v v) v)))
    (foo 4 :initial-contents '(a b c d) :double t)
     =>  #(A B C D A B C D)

  See Also:
    |funcall|, |fdefinition|, |function|, |cl-evaluation|
    |cl-apply-forms-as-places|.

Notes:

(none)

Note: See TracRoadmap for help on using the roadmap.
'