Jump to content

Duplicate in a list


RepCad

Recommended Posts

Maybe something as simple as this:

(defun foo (item lst) (vl-remove-if-not '(lambda (x) (equal item x)) lst))
;; (foo "1" '("1" "2" "3" "1" "1" "5" "1.0"))

Link to comment
Share on other sites

Ron,

_$ (foo "1" '("1" "2" "3" "1" "1" "5" "1.0"))
("1" "1" "1")

 

If he ment 'duplicate value' then "1.0" should be returned aswell, I think.

The OP should provide a sample list... and what he expects to be returned.

Link to comment
Share on other sites

Agreed .. just a quick example, not full blown solution. My guess is the OP probably want's a fuzz value too for numbers that should be 'equal'.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...