Talk:Apply a callback to an array: Difference between revisions

added a section header for the first topic to cause the TOC to be in the proper location.
(→‎array vs list: needs clarification)
(added a section header for the first topic to cause the TOC to be in the proper location.)
 
(11 intermediate revisions by 7 users not shown)
Line 1:
==properly defining task==
The problem is, of course, that they're all doing slightly different things. To some extent this is unavoidable due to language differences, but when one example is mapping the results into another array and a different example decides to print them, that's just a bit sloppy. Though I certainly don't mind if you have secondary examples demonstrating different techniques or modifications to the basic premise (such as the c++ use of a binary function).
 
:I wrote up some [[Help:Common Issues|guidelines]], but I need to make them more visible. I'll probably add them to--or link to them from--the programming task template.--[[User:Short Circuit|Short Circuit]] 12:46, 23 January 2007 (EST)
 
::The problem is that the task is not properly defined. There is the same problem with most of the tasks in Rosetta Code. I don't understand why it is so difficult to write even a few sentences to describe what to be done. Writing the specifications is the most importand part of any sofware project!
::--[[User:PauliKL|PauliKL]] 17:42, 28 August 2008 (UTC)
 
== array vs list ==
Line 15 ⟶ 19:
::::My opinion: I interpret this particular task as "Apply a callback to a '''collection'''". The array-ness is secondary, it is the callback that is of interest. --[[User:IanOsgood|IanOsgood]] 17:11, 15 January 2008 (MST)
:::::Did anybody notice there's no task description? This can all be wrapped with a clarification. Feel free to clean it up. --[[User:Short Circuit|Short Circuit]] 21:14, 15 January 2008 (MST)
::::::I did add a task description. I'm concerned that it may not be specific enough to qualify as a callback. I didn't use the term "collection", as that would have special meaning in VB.Net and (I think) Java. --[[User:Short Circuit|Short Circuit]] 00:19, 17 January 2008 (MST)
:::::I agree that the callback aspect is the gist of this task. This place might not be the best for me to have raised my concern. Still, it seems that the list-vs-array specification is part of a pattern of problem that occurs for some languages, under some tasks, which we may want to overcome by refinement of task descriptions. --[[User:TBH|TBH]] 21:25, 15 January 2008 (MST)
::::::That was my interpretation of the intent as well.--[[User:Short Circuit|Short Circuit]] 00:19, 17 January 2008 (MST)
 
== specifying callback ==
 
The opening sentence of the Wikipedia [http://en.wikipedia.org/wiki/Callback_%28computer_science%29 entry] is: "In computer programming, a callback is executable code that is passed as an argument to other code." The current task description does not seem to specify that a callback is to be used. ("In this task, the goal is to take a combined set of elements and apply a function to each element.") Just adding the word to this won't work, as we wish to communicate what counts as a callback. --[[User:TBH|TBH]] 07:10, 16 January 2008 (MST)
:I was never really clear on what a callback is. Is it like a composition operator? --[[User:Mwn3d|Mwn3d]] 19:01, 16 January 2008 (MST)
::I see callbacks and function composition as only weakly related for this purpose. Lambda notation always involves function composition, and its functions are always anonymous. I think function anonymity is not crucial to callbacks, but that it can be involved with some means of accomplishing it. --[[User:TBH|TBH]] 13:10, 18 January 2008 (MST)
:The task description needs to be changed. A lot of the code found here would be better placed in [[Loop Structures]]--but that task is currently being reconstructed by [[User:Marshmallows|Marshmallows]], so the task rewrite and review should probably wait until Marshmallows is done. At that point, though, this task should probably also be given a clearer name. I was thinking [[Apply a callback to members of a collection]]. But that might be too verbose. Thoughts? --[[User:Short Circuit|Short Circuit]] 23:30, 10 April 2008 (MDT)
As I understand it: A callback is characterized by passing executable code as an argument to other code. Anonymity is characterized by the absence of binding between a function and a name. --[[User:TBH|TBH]] 12:39, 18 January 2008 (MST)
 
== VB.NET ==
 
I removed the VB code because it doesn't work. Console.WriteLine doesn't return a value, and this cannot be used as an anonymous function.
 
== Problem Definition ==
 
Looking at the early history of this task, it seems that by "array" it is intended that "ordered sequence of values" be used and that "callback" means "run a bit of code" or maybe "apply a lambda term". Moreover, it's also clear that there is no need to update the sequence of values with the results of applying the lambda to each value. –[[User:Dkf|Donal Fellows]] 10:33, 4 January 2010 (UTC)