Jump to content

Talk:Associative array/Iteration: Difference between revisions

why not (but nothing to say about the name of the thing, if associative array or relation or whatever)
(Further notes)
(why not (but nothing to say about the name of the thing, if associative array or relation or whatever))
Line 7:
::: Dmitry, it's sufficient that many programmers using many different mappings will want to iterate over all items or keys in the the mapping (with that guarantees that every item will be visited once and only once). Regardless of whether that iteration conforms to any particular ordering it's clearly a suitable basis for comparison among different languages. If my work requires me to deal with some Java code using their HashMap collections then I'm very likely to need info on the closest equivalent to Python ''.keys()'' or ''.items()'' dictionary methods. Some mapping libraries, classes or types in some languages don't support this then it should absolutely be documented here (so that the programmer adopting such a language and learning about it here will KNOW that he or she must maintain a separate list of the valid keys).
 
:::: Maybe I was not clear enough. 1) It is not a language comparison task. It is comparison of container libraries. 2) The task name is misleading, because associative arrays are in general not iteratable. 3) A data structure that uses multiple indices is not an associative array, hash map. AFAIK, the technical term for that is '''relation''', and the relational algebra is there to build <nowiki>[</nowiki>sub<nowiki>]</nowiki>sets ordered according to this or that criterion (like SELECT in [[SQL]]). --[[User:Dmitry-kazakov|Dmitry-kazakov]] 12:24, 3 August 2009 (UTC)
 
::::: But if languages have built-in "container libraries", then it is a comparison task; C, Ada (I suppose) and others may be ruled out (if not using extern "container libraries" that may or may not provide the requested utility... a thing to be noted then!), but Python, Perl, PHP, Tcl, Smalltalk and others may not (and in fact they have a way of iterate over keys-values pair). Associative arrays should be always iterable I think. --[[User:ShinTakezou|ShinTakezou]] 12:51, 3 August 2009 (UTC)
Cookies help us deliver our services. By using our services, you agree to our use of cookies.