First class environments: Difference between revisions

m
→‎{{header|Perl 6}}: two changes to make it run again
m (Added Sidef)
m (→‎{{header|Perl 6}}: two changes to make it run again)
Line 696:
 
=={{header|Perl 6}}==
{{Works with|rakudo|2015-12-17}}
Fairly straightforward. Set up an array of hashes containing the current values and iteration counts then pass each hash in turn with a code reference to a routine to calculate the next iteration.
 
Line 702 ⟶ 703:
};
 
sub next (%this is rw, &get_next) {
return %this if %this.<value> == 1;
%this.<value>.=&get_next;
Line 709 ⟶ 710:
};
 
my @hailstones = map { $_ = %(value => $_, count => 0) }, 1 .. 12;
 
while not all( map { $_.<value> }, @hailstones ) == 1 {
2,392

edits