Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function binary(num)
- @match num begin
- 0 => 0
- 1 => 1
- _ => string(mod(num, 2), binary(div(num,2)))
- end
- end
- function tobinary(num)
- begin
- reverse(bin(num))
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement