Jensen's Device: Difference between revisions
Content added Content deleted
m (→{{header|Haskell}}: Added type signatures) |
m (→{{header|AppleScript}}: (normalized white space)) |
||
Line 108: | Line 108: | ||
on jsum(i, lo, hi, term) |
on jsum(i, lo, hi, term) |
||
set {temp, i's contents} to {0, lo} |
|||
repeat while i's contents ≤ hi |
|||
set {temp, i's contents} to {temp + (term's f(i)), (i's contents) + 1} |
|||
end repeat |
|||
return temp |
|||
end jsum |
end jsum |
||
script term_func |
script term_func |
||
on f(i) |
|||
return 1 / i |
|||
end f |
|||
end script |
end script |
||