Advertisement
Guest User

Potęgowanie

a guest
Oct 25th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. let powerList(base,n)=
  2. (*tworzy listę potęg*)
  3. let rec powerTail(base,i,prev,list)=
  4. if(i==n) then List.rev list
  5. else powerTail(base,i+1,prev*base,prev*base::list)
  6. in if (n>=0 || base==0) then powerTail(base,0,1,[1])
  7. else failwith("Podana złą wartość");;
  8.  
  9. powerList(2,0);;
  10. powerList(3,1);;
  11. powerList(4,2);;
  12. powerList(10,-2);;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement