Schematic: detect duplicate items in a list

Does R.6RS or Chez Scheme v7.9.4 have a library function to check if the list contains duplicate elements?

Alternatively, is there any built-in functionality for sets (which do not allow duplicate elements)? So far, I have been able to find here here .

The problem is that it does not seem to be part of the Chez Scheme library. Although I could write my own version of this, I would rather use a well-known, tested and supported library function, especially considering how basic this operation is.

Thus, a simple “use of these built-in functions” or “no built-in library” will suffice. Thank!

+5
source share
2 answers

SRFI 1 has a function in the list processingdelete-duplicates (so you can use it and check the length after that), and other functions that may be useful to you are quite possible.

+4
source

Kyle

At the same time, I needed to use several SRFIs with Chez Scheme. Some of them converted for use with Chez Scheme (including SRFI-1) are located at:

http://github.com/dharmatech/chez-srfi

After adding the path to 'chez-srfi' in CHEZSCHEMELIBDIRS, you can import SRFI-1:

(import (srfi: 1))

Ed

+3
source

All Articles