[r6rs-discuss] [Formal] Equivalence predicate version of memp

AndrevanTonder andre at het.brown.edu
Mon Sep 25 06:16:47 EDT 2006


Name        : Andre van Tonder
Email       : andre at het.brown.edu
Type        : enhancement
Priority    : minor
Component   : list utilities
Version     : 5.91
Pages       : 64-65
Dependencies: None

Summary:
--------

Memp is unwieldy and potentially inefficient in the very common
case where one tests for membership is based on an equivalence predicate.

Description:
------------

In my experience the most common usage pattern of generic membership is 
expressed by the SRFI-1 generic member procedure, which has to be expressed in 
r6rs as follows:

   (member x l =)  ==>  (memp (lambda (y) (= x y)) l)

This gets unwieldy to write, is hard to read, and is inefficient in the absence 
of smart optimizations.

Proposal:
---------

The inclusion of an additional procedure for generic membership based on an 
equivalence predicate argument.  One possibility is enhancing member with an 
extra optional argument, or using a new name for it such as mem=





More information about the r6rs-discuss mailing list