This is the mail archive of the
guile@sources.redhat.com
mailing list for the Guile project.
(ice-9 common-list) `uniq' replacement
- To: guile at sourceware dot cygnus dot com
- Subject: (ice-9 common-list) `uniq' replacement
- From: thi <ttn at revel dot glug dot org>
- Date: Sun, 23 Jul 2000 05:12:03 -0700
- Reply-to: ttn at glug dot org
this version of `uniq' doesn't overflow the default guile stack like the
one in (ice-9 common-list) does for very large inputs. the `reverse' is
habitual, feel free to omit it...
thi
________________________________
(define (ttn-uniq l)
(let loop ((acc '())
(l l))
(if (eq? '() l)
(reverse acc)
(loop (if (memq (car l) acc)
acc
(cons (car l) acc))
(cdr l)))))