[Top][All Lists]

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

Passing a list to a function

From: lisa-asket
Subject: Passing a list to a function
Date: Mon, 12 Jul 2021 14:36:40 +0200 (CEST)

What do you think of this code?  Is it valid?

(defvar hstyle-hdl
   '( ("@c h1" . 1) ("@c h2" . 2) ("@c h3" . 3) ("@c h4" . 4)
      ("@c h5" . 5) ("@c h6" . 6) ("@c h7" . 7) ("@c h8" . 8) )
   "Define names and levels for texinfo outline headings." )

(defun outline-headings (hdlevels)
  "Sets texinfo headings for use in outline mode."

    (setq outline-regexp
      (concat (regexp-opt (mapcar 'car hdlevels)) "\\>"))
    (setq outline-heading-alist hdlevels) )

(outline-headings hstyle-hdl)

From: Emanuel Berg via Users list for the GNU Emacs text editor 
Subject: Re: Passing a list to a function
Date: 12/07/2021 14:01:25 Europe/Paris

lisa-asket wrote:

> How can I make [a function] take [a] list as an argument?

It works like any other function and argument:

(defun is-this-a-list (lst)
(listp lst) )

(is-this-a-list 1) ; nil
(is-this-a-list '(1 2 3)) ; t

underground experts united

reply via email to

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