Set puzzle: Difference between revisions

m
Fix Perl6 -> Raku links and comments
(Rename Perl 6 -> Raku, alphabetize, minor clean-up)
m (Fix Perl6 -> Raku links and comments)
Line 263:
 
=={{header|AutoHotkey}}==
<lang autohotkey>; Generate deck; card encoding from Perl6Raku
Loop, 81
deck .= ToBase(A_Index-1, 3)+1111 ","
Line 2,792:
 
=={{header|Perl}}==
{{trans|Perl6Raku}}
It's actually slightly simplified, since generating Enum classes
and objects would be overkill for this particular task.
Line 2,799:
use warnings;
 
# This code was adapted from the perl6Raku solution for this task.
 
# Each element of the deck is an integer, which, when written
Line 3,294:
=={{header|Raku}}==
(formerly Perl 6)
 
The trick here is to allocate three different bits for each enum, with the result that the cards of a matching set OR together to produce a 4-digit octal number that contains only the digits 1, 2, 4, or 7. This OR is done by funny looking <tt>[+|]</tt>, which is the reduction form of <tt>+|</tt>, which is the numeric bitwise OR. (Because Perl 6Raku stole the bare <tt>|</tt> operator for composing junctions instead.)
<lang perl6>enum Color (red => 0o1000, green => 0o2000, purple => 0o4000);
enum Count (one => 0o100, two => 0o200, three => 0o400);
10,333

edits