Talk:Loop over multiple arrays simultaneously: Difference between revisions

From Rosetta Code
Content added Content deleted
(Suggestion)
(→‎Task clarification required?: You're getting off-track, Tikkanz)
Line 6: Line 6:
:True, bit which to choose? --[[User:Paddy3118|Paddy3118]] 03:27, 19 November 2009 (UTC)
:True, bit which to choose? --[[User:Paddy3118|Paddy3118]] 03:27, 19 November 2009 (UTC)
: I would suggest making a "same type" a primary goal for languages where it's convenient, and a second, separate "generic" example a secondary goal, and note which example goes with which goal. This keeps it simple for languages which support strong typing, allowing a little more showing off for languages with generics, and doesn't add a nonsensical requirement for languages with weak typing. --[[User:Short Circuit|Michael Mol]] 06:58, 19 November 2009 (UTC)
: I would suggest making a "same type" a primary goal for languages where it's convenient, and a second, separate "generic" example a secondary goal, and note which example goes with which goal. This keeps it simple for languages which support strong typing, allowing a little more showing off for languages with generics, and doesn't add a nonsensical requirement for languages with weak typing. --[[User:Short Circuit|Michael Mol]] 06:58, 19 November 2009 (UTC)
:For some languages, type declarations just aren't present (either because of type inference or because of the use of value systems which make it unnecessary). More importantly, '''''that's not the point of this task'''''. It's the looping construct that is significant, not the types of the data participating. (Well, assuming that the language can loop over arrays/lists of arbitrary element type; I can't think why anyone would restrict it, but someone somewhere might be silly enough.) –[[User:Dkf|Donal Fellows]] 09:09, 19 November 2009 (UTC)

Revision as of 09:09, 19 November 2009

Task clarification required?

It seems that some of the solutions have assumed that each of the arrays are of the same type (string) while others have assumed that the array (1,2,3) is a list/array of integers. The result is that solutions provided by any two languages do not necessarily solve the same task and are not necessarily directly comparable.

It might help readers compare the languages more easily, if the task be clarified to either specify that the code should handle arrays of different types, or that all arrays are the same type. --Tikkanz 00:21, 19 November 2009 (UTC)

True, bit which to choose? --Paddy3118 03:27, 19 November 2009 (UTC)
I would suggest making a "same type" a primary goal for languages where it's convenient, and a second, separate "generic" example a secondary goal, and note which example goes with which goal. This keeps it simple for languages which support strong typing, allowing a little more showing off for languages with generics, and doesn't add a nonsensical requirement for languages with weak typing. --Michael Mol 06:58, 19 November 2009 (UTC)
For some languages, type declarations just aren't present (either because of type inference or because of the use of value systems which make it unnecessary). More importantly, that's not the point of this task. It's the looping construct that is significant, not the types of the data participating. (Well, assuming that the language can loop over arrays/lists of arbitrary element type; I can't think why anyone would restrict it, but someone somewhere might be silly enough.) –Donal Fellows 09:09, 19 November 2009 (UTC)