Anonymous user
Jensen's Device: Difference between revisions
→{{header|AppleScript}}
Line 89:
on jsum(i, lo, hi, term)
set {temp, i's contents} to {0, lo}
▲ repeat with i from lo to hi
set temp to temp + (term's f(i))
set i's contents to (i's contents) + 1
end repeat
return temp
Line 103:
end script
return jsum(a reference to i, 1, 100, term_func)</lang>
Output: 5.18737751764
|