Deutsch   English   Français   Italiano  
<v7hj6b$3ooop$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!news.nobody.at!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: "B. Pym" <Nobody447095@here-nor-there.org>
Newsgroups: comp.lang.lisp
Subject: Re: Detele repeated in a list
Date: Sun, 21 Jul 2024 00:02:23 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 18
Message-ID: <v7hj6b$3ooop$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Injection-Date: Sun, 21 Jul 2024 02:02:23 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="d3ba06d1e9c3f008981fe6f00607550b";
	logging-data="3957529"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19ermEXW09aRp8zDyhxaMP3"
User-Agent: XanaNews/1.18.1.6
Cancel-Lock: sha1:UMdjeaSHypg9FiZPpquS98+BoQQ=
Bytes: 1248

Pascal Costanza wrote:

> (defun rem-duplicates (list)
>    (loop for (first . rest) on (append list list)
>          unless (member first (reverse rest) :test #'equal)
>          collect first))

Gauche Scheme

(define (rem-dups lst)
  (fold
    (lambda (x accum) (if (member x accum) accum (cons x accum)))
    '()
    lst))

(rem-dups '(0 2 3 4 (8 7) 3 2 0 (8 7)))
  ===>
(4 3 2 0 (8 7))