Talk:Search a list: Difference between revisions

"indexable, ordered collection" vs. "indexable ordered collection"
("indexable, ordered collection" vs. "indexable ordered collection")
 
Line 5:
:::You may be right. The collection type is obviously not the focus of this task, so it shouldn't be restricted if collections other than arrays fit the bill. It shouldn't be restricted to "haystack[i]" because first, some languages don't use that syntax and second, some collections which do support indexing do it through functions and methods (like nth from List or ArrayList.get() from Java). It should work for collections where if I run this function and get an index, then add an element to the "end" of the collection (that is, add an element to an end of the collection so that its index is greater than the index I got when I ran the function), then run the function again with the same arguments, I should get the same number. If that sounds like an OK specification, then which collections match it? --[[User:Mwn3d|Mwn3d]] 16:59, 26 November 2008 (UTC)
:I have changed the wording to indexable ordered collection which would include arrays, lists, tuples, hashes/dictionaries ... and removed access syntax which does not apply in some manguages. I hope it is suitably generic. --[[User:Paddy3118|Paddy3118]] 06:46, 27 November 2008 (UTC)
::The actual phrase on the Task page is "indexable, ordered collection", with a comma, implying a collection that's both indexable and in order (presumably ascending). All the solutions here seem to have copied each other in reading it as "indexable ordered collection" — an ordered (as opposed to labelled) collection that's also (superfluously?) described as indexable. Which is meant? --[[User:Nig|Nig]] ([[User talk:Nig|talk]]) 08:51, 9 July 2020 (UTC)
 
:P.S. I couldn't help extending the task too. --[[User:Paddy3118|Paddy3118]] 06:46, 27 November 2008 (UTC)
557

edits