Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let powerList(base,n)=
- (*tworzy listę potęg*)
- let rec powerTail(base,i,prev,list)=
- if(i==n) then List.rev list
- else powerTail(base,i+1,prev*base,prev*base::list)
- in if (n>=0 || base==0) then powerTail(base,0,1,[1])
- else failwith("Podana złą wartość");;
- powerList(2,0);;
- powerList(3,1);;
- powerList(4,2);;
- powerList(10,-2);;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement