in reply to Challenge: Generate a glob patterns from a word list
So what's your metric for "shortest"?
String length doesn't equal compression.
use v5.12; use warnings; use Data::Dump; use Test::More; test ( [ <{b,{c,d}e}> ], [ <{b,ce,de}> ], ); test ( [ <{c,d}e> ], [ <{ce,de}> ], ); sub test { my @g = @_; for my $i (0..$#g) { for my $j ($i+1..$#g) { is_deeply($g[$i],$g[$j],"$i,$j"); } } ddx @g; } done_testing;
ok 1 - 0,1 # challenge_choroba_globs.pl:26: (["b", "ce", "de"], ["b", "ce", "de"] +) ok 2 - 0,1 # challenge_choroba_globs.pl:26: (["ce", "de"], ["ce", "de"]) 1..2
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Challenge: Generate a glob patterns from a word list
by choroba (Cardinal) on May 05, 2021 at 18:45 UTC | |
by LanX (Saint) on May 05, 2021 at 19:04 UTC | |
by LanX (Saint) on May 05, 2021 at 19:28 UTC | |
by choroba (Cardinal) on May 06, 2021 at 09:37 UTC | |
by hippo (Archbishop) on May 06, 2021 at 10:54 UTC | |
by LanX (Saint) on May 06, 2021 at 11:04 UTC |