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

From: AndrevanTonder <andre>
Date: Mon Sep 25 06:32:18 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=
Received on Mon Sep 25 2006 - 06:16:47 UTC

This archive was generated by hypermail 2.3.0 : Wed Oct 23 2024 - 09:15:01 UTC