I wrote:
permute( @x_chars ) »{ $^a eq $^b ?? $^a :: ''}« permute( @y_chars )
Permutation is the wrong thing here, sorry. It's just:
( @x_chars »xx« @y_chars.elems ) # or was that .size?
»{ $^a eq $^b ?? $^a :: ''}«
( @y_chars xx @x_chars.elems ) # note: no hypering
e.g. a b c and x y give a
On 4/28/05, Thomas Sandlaß [EMAIL PROTECTED] wrote:
I wrote:
permute( @x_chars ) »{ $^a eq $^b ?? $^a :: ''}« permute( @y_chars )
Permutation is the wrong thing here, sorry. It's just:
I want to preface again that I have only recently started giving the
language aspect of p6 serious focus.
Joshua Gatcomb wrote:
... FAQs such as union, difference, intersection of lists are
FAQs for a reason.
... it would be nice to have a real simple easy answer for p6.
And indeed it could be:
use Sets;
my @a is Set = (1,2,3);
my @b is Set = (2,3,4);
say @a + @b; # (1,2,3,4)
say @a / @b; # (2,3)
Ok - sorry for the cheesy subject line but I couldn't resist.
So I am working on porting some interesting pieces of code I wrote in
p5 at the Monastery to p6 for the benefit of others - primarily to
show how easy the transition can be.
Since Pugs doesn't have p6 rules yet I wanted to show off
On Wed, Apr 27, 2005 at 08:46:53AM -0400, Joshua Gatcomb wrote:
The problem is that in the regex version I use capturing parens to
identify the character matched. For the purposes of the problem I
don't need to rely on the first character matched I just need to know
1.
Without doing a lot
Patrick R. Michaud wrote:
On Wed, Apr 27, 2005 at 08:46:53AM -0400, Joshua Gatcomb wrote:
The problem is that in the regex version I use capturing parens to
identify the character matched. For the purposes of the problem I
don't need to rely on the first character matched I just need to know
1.
Minor note.
Would you want this:
sub infix:myeq(Str $a, Str $b) { return ($a eq $b) ? $a : ''; }
to be:
sub infix:myeq(Str $a, Str $b) { return ($a eq $b) ? $a but bool::true:
''; }
(Is that the right way to do it ?)
Paul
On Wed, Apr 27, 2005 at 10:30:35AM -0600, Paul Seamons wrote:
Minor note.
Would you want this:
sub infix:myeq(Str $a, Str $b) { return ($a eq $b) ? $a : ''; }
to be:
sub infix:myeq(Str $a, Str $b) { return ($a eq $b) ? $a but bool::true:
''; }
(Is that the right way to do
Thomas Sandla writes:
Patrick R. Michaud wrote:
On Wed, Apr 27, 2005 at 08:46:53AM -0400, Joshua Gatcomb wrote:
The problem is that in the regex version I use capturing parens to
identify the character matched. For the purposes of the problem I
don't need to rely on the first character
On Wed, Apr 27, 2005 at 06:29:46PM +0200, Thomas Sandlaß wrote:
Patrick R. Michaud wrote:
my $matches = any( @x_chars ) eq any( @y_chars );
my $match = $matches.pick;
Perhaps the easiest way to explain the difficulty here is to note that
executing a relational op (i.e. returning a boolean)
Thomas Sandlaß wrote:
Patrick R. Michaud wrote:
On Wed, Apr 27, 2005 at 08:46:53AM -0400, Joshua Gatcomb wrote:
The problem is that in the regex version I use capturing parens to
identify the character matched. For the purposes of the problem I
don't need to rely on the first character matched I
On Wed, Apr 27, 2005 at 10:30:35AM -0600, Paul Seamons wrote:
Minor note.
Would you want this:
sub infix:myeq(Str $a, Str $b) { return ($a eq $b) ? $a : ''; }
to be [corrected]:
sub infix:myeq(Str $a, Str $b)
{ return ($a eq $b) ?? $a but bool::true :: ''; }
Perhaps, but I
Rod Adams writes:
Perhaps the easiest way to explain the difficulty here is to note that
executing a relational op (i.e. returning a boolean) value on a junction
argument returns a junction of boolean values.
Is that so? Does Perl6 have some fundamental law of junction
preservation?
I
Luke Palmer wrote:
Rod Adams writes:
Perhaps the easiest way to explain the difficulty here is to note that
executing a relational op (i.e. returning a boolean) value on a junction
argument returns a junction of boolean values.
Is that so? Does Perl6 have some fundamental law of
14 matches
Mail list logo