Title:
Please add more built-in closure functions: Array/Struct/List/QueryMap, Array/Struct/List/QueryReduce
| View in TrackerStatus/Resolution/Reason: Closed/Fixed/
Reporter/Name(from Bugbase): Adam Tuttle / Adam Tuttle (Adam Tuttle)
Created: 07/15/2013
Components: Language
Versions: 10.0
Failure Type: Enhancement Request
Found In Build/Fixed In Build: Final / 286271
Priority/Frequency: Trivial / Unknown
Locale/System: English / Platforms All
Vote Count: 3
Arrays, Structures, Lists, and Queries all need map and reduce functions. Map should both update the complex data structure in-place AND return the updated data structure (to allow method nesting), and reduce functions should return the final simple data result of the reduction.
All of these functions should get multiple arguments:
updatedArray = arrayMap([1,2,3], function(elementValue, index, originalArray){ return elementValue * index; });
sumColB = queryReduce(foo, function(memo = 0, row, originalQuery){ return memo + row.B; });
IMPORTANT: the Memo argument should not be passed at all for the first iteration of a reduce function. If you pass an empty string or something of the wrong type then the specified default value will not be used and it will require additional param logic inside the closure, which would be bad. For all other iterations, memo should contain the value returned from the previous iteration.
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3595198
External Customer Info:
External Company:
External Customer Name: Adam Tuttle
External Customer Email:
Attachments:
Comments: