Talk:Array

From Rosetta Code
Revision as of 19:38, 8 January 2008 by rosettacode>TBH (Abstract description will serve better than code, I think.)

What is this task actually asking to do? The explanation is reasonably straightforward (though it omits associative arrays entirely) but it doesn't say what is actually to be done. The single example (in C) computes a histogram over a file - is that what all (different-language) examples in this task should do? Sgeier 14:19, 2 January 2008 (MST)

This isn't a task, but an explanation of a data structure (check the backlinks). The code is just for illustration, and it probably shouldn't use the {header} template.
An associative array is an array in name only. It is a map of some sort underneath (e.g. alist, tree, hash). --IanOsgood 15:00, 2 January 2008 (MST)
It seems to me that code can provide, at best, an illustration of how the data structure can be implemented. It may be worth working to avoid equating the data structure, per se, with specifics of implementation. --TBH 15:40, 2 January 2008 (PST)
Oh, I guess I'm just kinda confused. I clicked on "solutions by task", there I clicked on "data structures" and there on "array". Maybe this organization is just a little awkward. So this means we don't need/want any further code examples here? Upon reading the description I immediately thought about FORTRAN (where the lower array boundary can be set to any number, even a negative one -- and that since 1977 ...) and IDL (where arrays are elevated to a kind of art form). Is it useful to show a couple languages worth of examples with maybe explanations how/where they deviate from what one would expect in other languages?
While I'm at it: the description here is somewhat informal; I've always thought of arrays as sets of elements in a mathematical sense -- numerically indexed they become ordered sets or as associative arrays they're simply unordered. In that sense, the line between "regular arrays" and associative arrays is actually not so wide. That's why I see no problem with, say, arrays of structures which contain scalars, strings and yet-other-arrays. For example. There's a subtle difference between an array of structures and a structure that holds arrayed data and there's a lot of beautiful (and, I fear, way too language-specific) code one could throw around here. Should we expand on that kind of thing here? How in C a[i] is the same as i[a] since arrays are just pointers, for example? How an n-dimensional array can be thought of as a k-dimensional array of (n-k)-dimensional arrays? That kind of thing?
(don't mind me, just throwing out ideas...) Sgeier 17:09, 3 January 2008 (MST)
Since its inception, I've wanted Rosetta Code to have encyclopedic content. Both our current browsing indexes focus on tasks, but there is a growing numper of non-task categories and pages that probably deserve a third, encyclopedic index. I'll get on that.
Oh...And I've only been as far as calc 2; Formal descriptions of computer science topics annoy the hell out of me, and are often beyond me. I have no problem with formal descriptions being on RC, but I definitely want to see informal descriptions accompanying them. --Short Circuit 23:26, 5 January 2008 (MST)
The example shown does not clearly demonstrate all the qualities of an array mentioned in the description. For instance, the description states that it is illegal to exceed the upper bound of an array. The example does not demonstrate any check for bounds overflow. The discussion does not indicate what happens to an array when the lower bound is violated. I think it would be good to provide an example more completely demonstrating the behaviors of an array.--Waldorf 16:39, 5 January 2008 (MST)
I share Waldorf's dissatisfaction with the example code. To reiterate my comment from last week, I doubt that this topic can be properly approached through code examples. Mind you, I love seeing assertions made in code; that's part of why I rely on J. This article should be accessible to everybody; it should not require knowledge of any computer language. So, the contents should be highly abstract and applicable to as broad a range of languages as possible. --TBH 12:38, 8 January 2008 (MST)