Lee Mac 发表于 2022-7-6 15:56:36

 
I'm not sure if there is a straight-forward function to detect this... I would be inclined to make a comparison between every item in the list and make a list of items already "viewed".

Lee Mac 发表于 2022-7-6 16:00:45

Perhaps something like this:
 

(defun getrep (alist) (foreach x alist   (if (member x nlist)   (setq dlist (cons x dlist))   (setq nlist (cons x nlist)))) dlist)(defun c:test () (alert (vl-princ-to-string (getrep '(a b c c d e f f g)))) (princ))

taner 发表于 2022-7-6 16:03:59

another way:
(eval(cons 'max a))
(eval(cons 'min a))

BIGAL 发表于 2022-7-6 16:12:12

If you sort the list then items the same will be next to each other so you can do things like count them up or delete duplicates.
页: 1 [2]
查看完整版本: Lisp: Extract highest/lowest v