Perl, 52 bytes
Perl, 52 54 bytes
Edit : Change condition with >=&<= to handle NaN + add note
sub k($c){join'',map$c<0|$c>$_map$c>=0&$c<=$_/10?"🔵""⚪":"🔵",0..9}
Note
It is possible to remove the join part, because Perl default behavior when you print an array is to join it, but it feel cheaty. What you guys think ?
Perl Cheaty version - 47 Bytes
sub k($c){map$c>=0&$c<=$_/10?"⚪":"🔵",0..9}
It uses "signatures 15 years beta" feature (activable via commande line -Mfeature=signature) or via import. The old school perl take 2 bytes more :
sub j{join'',map@_[0]<0|@_[0]>$_/10?"🔵":"⚪",0..9}
ExplicationExplaination :
sub j{
join ('', # Join each element of a list with the string ''.
map( # Return a list of what the block return for each element of the list passed in second argument
{@_[0]<0|@_[0]>$_/10?"🔵":"⚪"} , #@_[0] is the function first parameter, $_ the current iterated element
(0..9)) # Simple list
}
Other interesting solution :
The substr 61|59(signatures) Bytes,
probably fastest and lightest solution, (OK NaN)
sub b{substr'🔵'x(10).'⚪'x(10-(@_[0]<0?10:@_[0]*10)),-10}
sub p($c){substr'🔵'x(10).'⚪'x(10-($c<0?10:$c*10)),-10}
The for loop 55|57 Bytes
Work only once, dunno if it can be improve without too many bytes (KO NaN):
sub l($c){$a.=($c<0|$c>$_/10?"🔵":"⚪")for 0..9;$a}
Recursive 81|62 Bytes
Not very interesting at first, juste a copy cat of JS. But i run into a small bug on the "old perl" version (KO NaN):
sub a{(@_[1]//=10)?a(@_[0],@_[1]-1).(@_[0]<0|@_[0]>(@_[1]-1)/10?"🔵":"⚪"):''}
sub t($n,$i=10){$i?t($n,--$i).($n<0|$n>$i/10?"🔵":"⚪"):''}
I expected this to work :
sub z{(@_[1]//=10)?z(@_[0],--@_[1]).(@_[0]<0|@_[0]>(@_[1])/10?"🔵":"⚪"):''}
But it does not. --@_[1]@_1 do not work and i dont understand why.