Skip to content

Instantly share code, notes, and snippets.

@gfldex
Created May 30, 2012 12:13
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 gfldex/2835895 to your computer and use it in GitHub Desktop.
Save gfldex/2835895 to your computer and use it in GitHub Desktop.
huh?
use v6;
subset HTMLColor of Str where { * ~~ / '#'<:hexdigit> ** 6 / };
sub alternator (HTMLColor $a is copy, HTMLColor $b is copy){
return sub () {
return (($a, $b) = ($b, $a))[0];
}
}
my $bg_color := alternator('#00aa00', '#00bb00');
say $bg_color() for 1..10;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment