On Mon, 05 Dec 2016 12:14:05 -0800, c...@zoffix.com wrote:
> This code crashes with "Cannot unbox a type object (Any) to a str".
> 
> The problem goes away, if I change $^stuff to $_ or to $^stuff.List or
> to |$^stuff
> 
> 
> 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 };


Golfed a bit more:

[bag() but "house"].combinations.grep: { [⊎] $^stuff-we-want }

Any more thing I remove and the bug disappears.

Reply via email to