September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
10
Task/Binary-digits/Jq/binary-digits.jq
Normal file
10
Task/Binary-digits/Jq/binary-digits.jq
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
def binary_digits:
|
||||
if . == 0 then "0"
|
||||
else [recurse( if . == 0 then empty else ./2 | floor end ) % 2 | tostring]
|
||||
| reverse
|
||||
| .[1:] # remove the leading 0
|
||||
| join("")
|
||||
end ;
|
||||
|
||||
# The task:
|
||||
(5, 50, 9000) | binary_digits
|
||||
Loading…
Add table
Add a link
Reference in a new issue