Set right-adjacent bits: Difference between revisions

m
→‎{{header|Raku}}: added an example as per task spec
m (→‎{{header|Raku}}: fixed off-by-one error)
m (→‎{{header|Raku}}: added an example as per task spec)
Line 623:
 
=={{header|Raku}}==
{{incomplete|Raku|Missing the examples asked for}}
A left-to-right ordered collection of bits is more commonly referred to as an Integer in Raku.
 
Line 638 ⟶ 637:
}
 
say "Powers of 2 ≤ 8, 0 - Right-adjacent-bits: 2";
# Test with a few integers.
.&rab(2).base(2).fmt('%04s').say for <8 4 2 1 0>;
 
# Test with a few integers.
for 8,4, 18455760086304825618,5, 5444684034376312377319904082902529876242,15 -> $integer, $bits {
 
Line 652 ⟶ 653:
}</lang>
{{out}}
<pre>Integer:Powers of 2 ≤ 8, 0 - Right-adjacent-bits: up to 42
1110
0111
0011
0001
0000
 
Integer: 8 - Right-adjacent-bits: up to 4
1000
1100
2,392

edits