Talk:Comparison of programming languages (array)

message: Are you sure that native python supports vectorized operations? I am under the impression that this requires an external set of packages such as numpy. If so, then "yes" in the vectorized column is a bit misleading and a footnote should be added explaining this. —Preceding unsigned comment added by Ty8inf (talk • contribs) 18:54, 17 January 2008 (UTC)
replies: text: Note that there is no reason for footnote 18 - because with 3rd party extension every programming lanugage - including assember support vectorized operations - this is nothing special which need to be mentioned. Also note that I did not put down an Yes for Ada even while Ada has "Ada.Numerics.Generic_Real_Arrays" and "Ada.Numerics.Generic_Complex_Arrays" - but they are libraries and not language features. --Krischik T 08:49, 30 March 2008 (UTC)
replies: text:  >>> x = [1,2,3]  >>> y = [4,5,6] >>> map(lambda a,b: a+b, x,y) [5, 7, 9] just using keywords :) --77.3.191.111 (talk) 13:33, 6 August 2010 (UTC)
thread_title: Vectorized Operations in Python

message: The table would benefit if there were two columns. One for support for multi-dimensional arrays and the other for support for arrays of arrays. I think it's always true that a language supporting arrays of arrays can emulate multi-dimensional arrays, so this fact should be in a paragraph and not a footnote. I also think it's always true that a language supporting arrays of arrays can have triangular arrays. That may be worth mentioning also. Unfortunately I'm not knowledgeable about all the languages in the table to make the change myself. —Egriffin (talk) 21:31, 23 January 2008 (UTC)
replies: text: Indeed an extra article is needed - also mentioning which features are not supported by the emulation - two dimensional array slices come to my mind here. Mind you: most languages which don't support two dimensional arrays also don't support array slices. And this might not be a coincidence: Having one but not the other might not make much sense. Note: Triangular arrays need access types and heap memory in the middle (C/C++ users might might overlook that because C/C++ mixes the two concepts into some mushy hybrid). --Krischik T 09:10, 11 February 2008 (UTC)
thread_title:  Multi-dimensional arrays vs. Arrays of arrays 

message: I know that PHP defines array slices, but I see nothing to indicate
that PHP supports the type of vectorized arithmetic operations that
pertains to this article.  Could someone knowledgable comment on PHP's
capabilities in this area? -- Ty8inf (talk) 01:27, 29 January 2008 (UTC)
thread_title:  Vectorized Operations in PHP 

message: I've corrected the Visual Basic lowerbound to 0.  To quote the VB 6.0 help, "Because the default base is 0, the Option Base statement is never required."  
NB. The default lowerbound was also 0 in QBasic, GW-Basic and iirc earlier MS Basics.  So the article, in specifying 1 as the default lowerbound for BASIC, may be incorrect, depending which edition of BASIC it is talking about (the original Dartmouth one maybe?).  —Preceding unsigned comment added by 195.72.173.51 (talk) 15:11, 11 December 2008 (UTC)
thread_title:  VB 

message: You can find the number of elements in a C array because the sizeof operator returns the number of bytes occupied by an array. It even works for multi-dimensional arrays.
#include <stdio.h>
int main(void) {
	int array[][4] = {{1, 2, 3, 0}, {4, 5, 6, 0}, {7, 8, 9, 0}};
	unsigned long nelm, nrow, ncol;
	
	printf("The array occupies %lu bytes.\n", sizeof(array));
	printf("Each row in the array occupies %lu bytes.\n", sizeof(*array));
	printf("Each element in the array occupies %lu bytes.\n", sizeof(**array));
	nelm = sizeof(array) / sizeof(**array); /* number of elements */
	nrow = sizeof(array) / sizeof(*array); /* number of rows */
	ncol = sizeof(*array) / sizeof(**array); /* number of columns */
	printf("The array has %lu elements in %lu rows by %lu columns.\n", nelm, nrow, ncol);
	
	return 0; 
}
 
The output is:
  The array occupies 48 bytes.
  Each row in the array occupies 16 bytes.
  Each element in the array occupies 4 bytes.
  The array has 12 elements in 3 rows by 4 columns.
The sizes are implementation/hardware dependent, but the simple math for the number of elements works out despite of this. This method is commonly used when passing an array to a function. Otherwise the size information is lost because an array is converted to a pointer to the first element when it is passed to a function. Jebix (talk) 05:10, 17 December 2008 (UTC)
thread_title: Array Sizes in C

message: {
	double array_data[1024], *array;
	int n;
	array = &(array_data[512]);
	
	for (n=-512; n<512; n++)
	{
		array[n] = (double)n;
	}
	
}
96.252.13.17 (talk) 00:34, 28 February 2010 (UTC)
thread_title:  Simple source snippet to justify my edit. 

message: no mention of Scratch (MIT), Sense (OU) or LabVIEW (National Instruments)
Unsure about Scratch, but Sense uses 1-indexed and LabVIEW uses zero-indexed arrays/lists  — Preceding unsigned comment added by 86.1.43.198 (talk) 01:16, 4 March 2014 (UTC)
thread_title:  Scratch (MIT), Sense (OU) or LabVIEW 

message: User:Mkcmkc has restored an edit I reverted Jan19.  This adds the following paragraph just before the table in the Syntax/Array dimensions section:
:Note particularly that some languages index from zero while others index from one.  At least since Dijkstra's famous essay https://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html, zero-based indexing has been seen as superior, and new languages tend to use it.
My reasons for reverting this originally was that while the first sentence is true, it's somewhat redundant (the table actually provides that information on a per-language basis, as does the fourth table in the article) and really doesn't belong here.  It's also incomplete (many languages can, at least optionally, starting indexing from values other than zero or one), and somewhat poorly worded.  The second sentence, while a valid reference to Dijkstra's paper, presents a definite value judgment about the choice of base, which seems inappropriate in this article comparing different languages, even if the judgment is likely the consensus (and I'm not really sure that it is - I think it's likely for languages intended for professional developer's use, but languages inteded for non-specialists may well be different).  The final part, that "new languages tend to use it" is unreferenced, although it's plausibly true.  Rwessel (talk) 07:15, 31 March 2015 (UTC)
replies: text: I fail to see why the Dijkstra reference is crucial *here*.  In an article on programming language design, sure, but not here.  This article does not justify or evaluate the choices made by the various languages, it merely enumerates them.  Nor is the pejorative "toys" useful.  As I mentioned I suspect 1 is the default base in more than a few domain specific languages, calling those "toys" is not helpful.  And then there's LUA, which is certainly serious, and most definitely not a toy.  Rwessel (talk) 00:46, 14 May 2015 (UTC)
thread_title:  Edit by [[user:Mkcmkc]] on zero/one based array indexing 

message: The Wikipedia data structure articles generally do not distinguish between the CompSci terms "list" (an ordered group of items) and the more-specific "array" (an ordered group of items of the same kind). And, in some languages, lists are implemented using arrays (such as an array of pointers in C.) That is not a problem in-and-of-itself, but I recommend that we add a column to the comparitive list to add clarity. That let's the reader see whether the array data structure is strict in the sense seen in C/C++ or is list-like like seen in some dynamic languages such as Python. Example:
>>> mylist = [1, 3.2, "hello", None, MyFavoriteClass()]
Proposed modified table header:
 
Programming language	Default base index	Specifiable index type	Specifiable base index	Bound check	Multidimensional	Dynamically-sized	Vectorized operations	Fixed Type
The "Fixed Type" column would have either "yes", "no"; or perhaps "single" or "mixed".
JohnAD (talk) 21:15, 15 December 2017 (UTC)
thread_title:  Add "fixed type" to "Array system cross-reference list" table 

message: * In the several subsections in which APL code is presented, lines for APL quite understandably use "ρ" (U+03C1) and "ι" (U+03B9) for the APL functional symbols Rho and Iota — however the Unicode codepoints (U+2374 and U+2373) for these symbols are what APL interpreters actually use.  This distinction is important because if one were to Copy and Paste the existing text as is into a Unicode APL session, it would not execute because no Unicode-based APL interpreter recognizes U+03C1 and U+03B9 as APL functional symbols.  Instead, these and related characters should be reserved for when the character set for APL names is extended to the Greek language.
* Also, instances of APL functional symbols in the HTML Numeric Character Reference form (&#xXXXX;) can be changed to the single character APL functional symbol for better readability.
As these are very minor changes meaningful to APL programmers only and invisible to everyone else, I propose we publish these changes.
Sudleyplace (talk) 16:09, 12 January 2018 (UTC)
thread_title:  Minor Change To APL Characters 

message: According to the Wolfram Language page, Mathematica uses Wolfram language for its computations. I see no reason to include both in this comparison when they are the same language.  — Preceding unsigned comment added by 129.93.191.80 (talk) 15:15, 8 September 2018 (UTC)
thread_title:  Separate Entries for Wolfram Language and Mathematica 

message: Now that  has been part of the C++ language definition for a dozen years (since C++11), it would probably make sense to adjust the C++ entries accordingly -- e.g. the "Array system cross-reference list" shows C++ as having no bounds checking even though  has element access methods which are bounds checked (.at(); plus ones which aren't like operator[]).   has size, first, and last functionality, which ought to qualify it for inclusion in the "Array dimensions" table (I assume the lack of all those in C-style arrays is what kept C and C++ out of that table, even though Jebix fifteen years ago entered a comment above showing C/C++ recipes for all those?).  And C++20 also has  providing slice functionality.
In fact, it's probably useful to separate out C-style arrays (supported in C and C++) from , since many of the features summarized on this page differ between the two.  --24.91.152.172 (talk) 15:10, 7 March 2023 (UTC)
thread_title:  C++ adjustments for std::array