Binary digits: Difference between revisions
Content deleted Content added
→min: define 'bin' as a proper operator |
→Joy: create a proper string for better reusability |
||
Line 2,892: | Line 2,892: | ||
9000 -> 一〇〇〇一一〇〇一〇一〇〇〇</pre> |
9000 -> 一〇〇〇一一〇〇一〇一〇〇〇</pre> |
||
=={{header|Joy}}== |
=={{header|Joy}}== |
||
<syntaxhighlight lang="joy"> |
<syntaxhighlight lang="joy">DEFINE bin == "" [pop 1 >] [[2 div "01" of] dip cons] while ["01" of] dip cons. |
||
_ == [null] [pop] [2 div swap] [48 + putch] linrec |
|||
⚫ | |||
IN |
|||
{{out}} |
|||
int2bin == [null] [48 + putch] [_] ifte '\n putch |
|||
<pre>["0" "1" "10" "101" "110010" "10001100101000"]</pre> |
|||
END</syntaxhighlight> |
|||
Using int2bin: |
|||
<syntaxhighlight lang="joy">0 setautoput |
|||
0 int2bin |
|||
5 int2bin |
|||
50 int2bin |
|||
⚫ | |||
=={{header|jq}}== |
=={{header|jq}}== |
||
<syntaxhighlight lang="jq">def binary_digits: |
<syntaxhighlight lang="jq">def binary_digits: |