Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # let rec fact = function 0 -> 1 | n -> n * fact (n - 1);;
- val fact : int -> int = <fun>
- # fact 5;;
- - : int = 120
- # #trace fact;;
- fact is now traced.
- # fact 5;;
- fact <-- 5
- fact <-- 4
- fact <-- 3
- fact <-- 2
- fact <-- 1
- fact <-- 0
- fact --> 1
- fact --> 1
- fact --> 2
- fact --> 6
- fact --> 24
- fact --> 120
- - : int = 120
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement