Binary digits: Difference between revisions
Content added Content deleted
(→min: update) |
|||
Line 3,589: | Line 3,589: | ||
io.write_string(int_to_base_string(N, 2), !IO), |
io.write_string(int_to_base_string(N, 2), !IO), |
||
io.nl(!IO).</syntaxhighlight> |
io.nl(!IO).</syntaxhighlight> |
||
=={{header|min}}== |
=={{header|min}}== |
||
{{works with|min|0. |
{{works with|min|0.37.0}} |
||
<syntaxhighlight lang="min">( |
<syntaxhighlight lang="min">( |
||
(dup 2 <) 'string |
|||
(dup odd? "1" "0" if swap 1 shr) 'prefix |
|||
linrec |
|||
⚫ | |||
⚫ | |||
( |
|||
:n () =list |
|||
(n 0 >) (n divmod2 list append #list @n) while |
|||
list reverse 'string map "" join |
|||
"^0+" "" replace ;remove leading zeroes |
|||
⚫ | |||
⚫ | |||
{{out}} |
{{out}} |
||
<pre>0 1 10 101 110010 10001100101000</pre> |
|||
<pre> |
|||
101 |
|||
110010 |
|||
10001100101000 |
|||
</pre> |
|||
=={{header|MiniScript}}== |
=={{header|MiniScript}}== |
||
=== Iterative === |
=== Iterative === |