Skip to content

Instantly share code, notes, and snippets.

@jmaslak
Last active May 11, 2019 18:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmaslak/b5820c5c2fce4f5af600ab034a70340d to your computer and use it in GitHub Desktop.
Save jmaslak/b5820c5c2fce4f5af600ab034a70340d to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl6
# On 2019.3.1 this gives:
# The iterator of this Seq is already in use/consumed by another Seq
# (you might solve this by adding .cache on usages of the Seq, or
# by assigning the Seq into an array)
# in block <unit> at ./ch-2.p6 line 11
use v6;
my $src = 'a';
my @words = ['a', 'b', 'c', 'd'];
my @pending.push: { word => "123" };
for 1..10 {
my $checkword = @pending.shift;
my $aa = $checkword<word>.join;
my $bb = $checkword<word>.join;
my @potentials = find_one_off(@words);
for @potentials -> $potential {
@pending.push: { word => $potential };
}
}
sub find_one_off ( @words ) {
state %cache;
return %cache{'abc'} //= @words.grep( { 1 == 2 } );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment