Function: hash-set-of-strings

hash-set-of-strings is a byte-compiled function defined in hasht.el.

Signature

(hash-set-of-strings SORTED-STRINGS &optional COUNT)

Documentation

Return SORTED-STRINGS list with any duplicate entries removed.

Optional COUNT conses number of duplicates on to front of list before return.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hasht.el
;;; ************************************************************************
;;; Private functions
;;; ************************************************************************

(defun hash-set-of-strings (sorted-strings &optional count)
  "Return SORTED-STRINGS list with any duplicate entries removed.
Optional COUNT conses number of duplicates on to front of list before return."
  (and count (setq count 0))
  (let ((elt1) (elt2) (lst sorted-strings)
	(test (if count
		  (lambda (a b)
		    (when (string-equal a b)
		      (setq count (1+ count))
		      t))
                #'string-equal)))
    (while (setq elt1 (car lst) elt2 (car (cdr lst)))
      (if (funcall test elt1 elt2)
	  (setcdr lst (cddr lst))
	(setq lst (cdr lst)))))
  (if count (cons count sorted-strings) sorted-strings))