Advertisement
Guest User

Untitled

a guest
Feb 26th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. function binary(num)
  2. @match num begin
  3. 0 => 0
  4. 1 => 1
  5. _ => string(mod(num, 2), binary(div(num,2)))
  6. end
  7. end
  8.  
  9. function tobinary(num)
  10. begin
  11. reverse(bin(num))
  12. end
  13. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement