Currying: Difference between revisions

m
→‎{{header|AppleScript}}: Updated primitive
m (Add to Category:Functions and subroutines)
m (→‎{{header|AppleScript}}: Updated primitive)
Line 25:
The nearest thing to a first-class function in AppleScript is a 'script' in which a 'handler' (with some default or vanilla name like 'call' or 'lambda' is embedded). First class use of an ordinary 2nd class 'handler' function requires 'lifting' it into an enclosing script – a process which can be abstracted to a general mReturn function.
 
<lang AppleScript>-- curry :: (Script|Handler) -> Script
-- curry :: (Script|Handler) -> Script
on curry(f)
set mf to mReturn(f)
script
on lambda(a)
script
on lambda(b)
mf's lambda(a, b) of mReturn(f)
end lambda
end script
Line 125 ⟶ 123:
end repeat
return lst
end range</lang>
</lang>
 
{{Out}}
9,659

edits