Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- % Example: {Fact 4} has to return [1 2 6 24]
- declare
- fun {Fact N}
- local FactAcc in
- fun {FactAcc R L}
- if (R==N) then {Reverse L}
- else {FactAcc R+1 (L.1*(R+1))|L}
- end
- end
- {FactAcc 1 [1]}
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement