Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Egotist: A person of low taste, more interested in himself than in me. -- Ambrose Bierce


devel / comp.lang.lisp / Faster remove-duplicates with sorted list.

SubjectAuthor
o Faster remove-duplicates with sorted list.Robert L.

1
Faster remove-duplicates with sorted list.

<su64e4$10bg$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=16831&group=comp.lang.lisp#16831

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!news.niel.me!aioe.org!NDfxRBuCiRvCDaRamFkRZA.user.46.165.242.75.POSTED!not-for-mail
From: No_spamming@noWhere_7073.org (Robert L.)
Newsgroups: comp.lang.lisp
Subject: Faster remove-duplicates with sorted list.
Date: Fri, 11 Feb 2022 16:55:32 -0000 (UTC)
Organization: Aioe.org NNTP Server
Message-ID: <su64e4$10bg$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Injection-Info: gioia.aioe.org; logging-data="33136"; posting-host="NDfxRBuCiRvCDaRamFkRZA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: XanaNews/1.18.1.6
X-Notice: Filtered by postfilter v. 0.9.2
 by: Robert L. - Fri, 11 Feb 2022 16:55 UTC

> (defun uniquify-sorted-list (list &key (key #'identity) (test #'eql))
> (loop for element in list
> for element-key = (funcall key element)
> for last-element-key = (load-time-value (gensym))
> then element-key
> unless (funcall test element-key last-element-key)
> collect element))

Gauche Scheme:

(define (destutter seq :optional (test equal?) (key values))
(if (or (null? seq) (null? (cdr seq)))
seq
(let ((ab (take seq 2)))
(if (apply test (map key ab))
(destutter (cdr seq) test key)
(cons (car ab) (destutter (cdr seq) test key))))))

(destutter '(0 0 1 2 3 3 3 4 5))
===>
(0 1 2 3 4 5)

(destutter '(0 0 2 3 5 7 6 8) eq? odd?)
===>
(2 7 8)


devel / comp.lang.lisp / Faster remove-duplicates with sorted list.

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor