Higher-order functions: Difference between revisions

→‎{{header|AppleScript}}: updated primitives
m (→‎{{header|AppleScript}}: Removed a comment duplication)
(→‎{{header|AppleScript}}: updated primitives)
Line 254:
set lst to {}
repeat with i from 1 to lng
set end of lst to lambda|λ|(item i of xs, i, xs)
end repeat
return lst
Line 273:
set lng to length of xs
repeat with i from 1 to lng
set v to lambda|λ|(v, item i of xs, i, xs)
end repeat
return v
Line 289:
repeat with i from 1 to lng
set v to item i of xs
if lambda|λ|(v, i, xs) then set end of lst to v
end repeat
return lst
Line 302:
else
script
property lambda|λ| : f
end script
end if
Line 328:
x mod 2 = 0
end isEven</lang>
 
{{Out}}
<lang applescript>{{0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20},
9,655

edits