Sum and product of an array: Difference between revisions
→{{header|AppleScript}}
Line 205:
set lstRange to {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
{{sum:reduce(
{product:reduce(product, 1, lstRange)}}
end run
Line 227 ⟶ 228:
-- i: [ 1-based index in list ] optional
-- l: [ a reference to the list itself ] optional
on reduce(
script mf
property lambda : f
end script
set v to
repeat with i from 1 to length of xs
set v to mf's lambda(v, item i of xs, i, xs)
Line 241 ⟶ 242:
{{Out}}
<
=={{header|AutoHotkey}}==
|