Skip to content

Instantly share code, notes, and snippets.

@zoffixznet
Created December 5, 2016 20:20
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 zoffixznet/6b73e7f0e039db3d00facadc1f5c1db4 to your computer and use it in GitHub Desktop.
Save zoffixznet/6b73e7f0e039db3d00facadc1f5c1db4 to your computer and use it in GitHub Desktop.
my $materials = bag flat 'wood' xx 300, 'glass' xx 100, 'brick' xx 3000;
my @wanted =
bag(flat 'wood' xx 200, 'glass' xx 50, 'brick' xx 3000) but "house",
bag(flat 'wood' xx 100, 'glass' xx 50) but "shed",
bag( 'wood' xx 50) but "dog-house";
say 'I can build...';
.put for @wanted.combinations.grep: { $materials ≽ [⊎] |$^stuff-we-want };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment