Next Previous Up Top Contents Index

2.6 The COMMON-EXTENSIONS module

position

Open generic function

Summary

Returns the key at which a particular value occurs in a sequence.

Signature

position sequence value #key predicate skip => key 

Arguments

sequence
An instance of <sequence>.

value
An instance of <object>.

predicate
An instance of <function>. Default value: \==.

skip
An instance of <integer>. Default value: 0.

Values

key
An instance of <object>.

Library

common-extensions

Module

common-extensions

Description

Returns the key at which value occurs in sequence.

If predicate is supplied, position uses it as an equivalence predicate for comparing sequence's elements to value. It should take two objects and return a boolean. The default predicate used is \==.

The skip argument is interpreted as it is by Dylan's find-key function: position ignores the first skip elements that match value, and if skip or fewer elements satisfy predicate, it returns #f.


Common Dylan and Functional Extensions - 31 Mar 00

Next Previous Up Top Contents Index