Function: make-list

make-list is a function defined in alloc.c.

Signature

(make-list LENGTH INIT)

Documentation

Return a newly created list of length LENGTH, with each element being INIT.

Other relevant functions are documented in the list group.

View in manual

Shortdoc

;; list
(make-list 5 'a)
    => (a a a a a)

Source Code

// Defined in /usr/src/emacs/src/alloc.c
{
  Lisp_Object val = Qnil;
  CHECK_FIXNAT (length);

  for (EMACS_INT size = XFIXNAT (length); 0 < size; size--)
    {
      val = Fcons (init, val);
      rarely_quit (size);
    }

  return val;
}