Function: erc-ports-list

erc-ports-list is a byte-compiled function defined in erc-networks.el.gz.

Signature

(erc-ports-list PORTS)

Documentation

Return a list of PORTS.

PORTS should be a list of either:
  A number, in which case it is returned a list.
  Or a pair of the form (LOW HIGH), in which case, a list of all the
  numbers between LOW and HIGH (inclusive) is returned.

As an example:
  (erc-ports-list '(1)) => (1)
  (erc-ports-list '((1 5))) => (1 2 3 4 5)
  (erc-ports-list '(1 (3 5))) => (1 3 4 5)

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc-networks.el.gz
(defun erc-ports-list (ports)
  "Return a list of PORTS.

PORTS should be a list of either:
  A number, in which case it is returned a list.
  Or a pair of the form (LOW HIGH), in which case, a list of all the
  numbers between LOW and HIGH (inclusive) is returned.

As an example:
  (erc-ports-list \\='(1)) => (1)
  (erc-ports-list \\='((1 5))) => (1 2 3 4 5)
  (erc-ports-list \\='(1 (3 5))) => (1 3 4 5)"
  (let (result)
    (dolist (p (ensure-list ports))
      (cond ((numberp p)
	     (push p result))
	    ((listp p)
	     (setq result (nconc (cl-loop for i from (cadr p) downto (car p)
					  collect i)
				 result)))))
    (nreverse result)))