Re: `position' in rep...?

On Monday 06 June 2011 23:19:43 Jeremy Hankins wrote:
> I wrote a version of the position function that would work with
> circular lists, since the other one will start an infinite loop if
> you give it a circular list.

Many functions do. Basically anything that loops through the elements of 
a list will get stuck. Your fix does not work either if the list cycles 
back not to its head but some later element. Cyclic lists are rare and 
it has not been deemed useful to check for them in every library 
function. Common Lisp has list-length that checks for cycles (standard 
length does not).

A useful extension for position would be vector support. Because 
indexing lists is inefficient, position should preferably be used with 

	Timo Korvola		<URL:>

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]