Last active
August 17, 2017 13:27
-
-
Save ragnard/eff51d6afd36f79d1558cdd7951a9fc4 to your computer and use it in GitHub Desktop.
tail recursion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun count-down (n) | |
(if (= n 0) | |
done | |
(count-down (- n 1)))) | |
(count-down 1000000) | |
(count-down 1000000) | |
(count-down 1000000) | |
(count-down 1000000) | |
(count-down 1000000) | |
(count-down 1000000) | |
(count-down 1000000) | |
(count-down 1000000) | |
(count-down 1000000) | |
(count-down 1000000) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
functor | |
import | |
System(showInfo:Show) | |
Boot_Time at 'x-oz://boot/Time' | |
define | |
fun {CountDown N} | |
if N = 0 then | |
N | |
else | |
{CountDown (N - 1)} | |
end | |
end | |
for I in 1..10 do | |
local | |
T0={Boot_Time.getMonotonicTime} | |
{Show {CountDown 1000000}} | |
T1={Boot_Time.getMonotonicTime} | |
in | |
{Show (T1-T0) div 1000000} | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment