# New Ticket Created by Carl Mäsak
# Please include the string: [perl #81336]
# in the subject line of all future correspondence about this issue.
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=81336
masak rakudo: say 0 ~~ 0 ~~ 0
p6eval rakudo cae7f9: OUTPUT«Bool::False»
* masak
Hello,
After a long absence (been busy) I'm trying to re-learn Perl 6. I'm
reading the book Using Perl 6, from Jonathan S, Moritz, Mäsak, PM
and Jonathan W.:
http://github.com/downloads/perl6/book/2010.08.a4.pdf
I tested the first program using the latest release of Rakudo Star.
The first
Daniel Carrera wrote:
I tested the first program using the latest release of Rakudo Star.
The first program has the following:
my @sorted = @names.sort({ %sets{$_} }).sort({ %matches{$_} }).reverse;
This works correctly, but it's long and I'd rather format this line like this:
This works
On Mon, Dec 27, 2010 at 8:37 PM, Darren Duncan dar...@darrenduncan.netwrote:
A relevant reading would be
http://perlcabal.org/syn/S02.html#Whitespace_and_Comments I think; what
you are trying to do may not directly be allowed, though there may be
workarounds such as by using unspace.
Hello,
Looking at the first example in Using Perl6, I have:
if $r1 $r2 {
%matches{$p1}++;
} else {
%matches{$p2}++;
}
I was thinking that it should be possible to make this more compact, but the
two ideas I tried didn't work:
# Idea 1 gives: Unable to parse postcircumfix:sym{ },
On Mon, Dec 27, 2010 at 15:46, Daniel Carrera dcarr...@gmail.com wrote:
Hello,
Looking at the first example in Using Perl6, I have:
if $r1 $r2 {
%matches{$p1}++;
} else {
%matches{$p2}++;
}
I was thinking that it should be possible to make this more compact, but the
two ideas I
On 27-12-2010 21:46:05, Daniel Carrera wrote:
Hello,
Looking at the first example in Using Perl6, I have:
if $r1 $r2 {
%matches{$p1}++;
} else {
%matches{$p2}++;
}
I was thinking that it should be possible to make this more compact, but the
two ideas I tried didn't work:
On Mon, Dec 27, 2010 at 9:49 PM, Chas. Owens chas.ow...@gmail.com wrote:
The [conditional operator][1] is now spelled test ?? true !! false not
test ? true : false.
Thanks!
Now the following code works:
%matches{ $r1 $r2 ?? $p1 !! $p2 }++;
I'm still having trouble with the other
On Mon, Dec 27, 2010 at 15:55, Daniel Carrera dcarr...@gmail.com wrote:
On Mon, Dec 27, 2010 at 9:49 PM, Chas. Owens chas.ow...@gmail.com wrote:
The [conditional operator][1] is now spelled test ?? true !! false not
test ? true : false.
Thanks!
Now the following code works:
%matches{ $r1
On 12/27/2010 09:12 PM, Daniel Carrera wrote:
Thanks. The blacklash unspace works.
my @sorted = @names.sort({ %sets{$_} })\
.sort({ %matches{$_} })\
.reverse;
Though I'm a bit sad that you need that and you can't just separate methods
with spaces.
On 12/27/2010 09:55 PM, Daniel Carrera wrote:
On Mon, Dec 27, 2010 at 9:49 PM, Chas. Owens chas.ow...@gmail.com wrote:
The [conditional operator][1] is now spelled test ?? true !! false not
test ? true : false.
Thanks!
Now the following code works:
%matches{ $r1 $r2 ?? $p1 !! $p2
On Mon, Dec 27, 2010 at 16:00, Chas. Owens chas.ow...@gmail.com wrote:
On Mon, Dec 27, 2010 at 15:55, Daniel Carrera dcarr...@gmail.com wrote:
On Mon, Dec 27, 2010 at 9:49 PM, Chas. Owens chas.ow...@gmail.com wrote:
The [conditional operator][1] is now spelled test ?? true !! false not
test ?
On Mon, Dec 27, 2010 at 10:00 PM, Moritz Lenz mor...@faui2k3.org wrote:
But there's a good reason: .method is a term on its own, and actually
means $_.method. So if you write @names.foo .bar, that's two terms in a
row.
That is indeed a good reason. I think I knew about it but forgot. That
On Mon, Dec 27, 2010 at 10:03 PM, Chas. Owens { } by itself creates a
lambda (i.e. an anonymous function), so it may
be that you are returning an anonymous function that never gets
executed. Try using parentheses instead of braces.
Or better yet, don't use anything. Since ++ has higher
On Mon, Dec 27, 2010 at 10:03 PM, Moritz Lenz wrote:
or
my $closure = $r1 $r2 ?? { %matches{$p1}++ } !! { %matches{$p2}++ };
# invoke it
$closure();
That's very cool. Perl 6 is a functional language with lambdas and
everything.
Daniel.
--
No trees were destroyed in the generation of
# New Ticket Created by Carl Mäsak
# Please include the string: [perl #81352]
# in the subject line of all future correspondence about this issue.
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=81352
masak rakudo: say defined Nil; say defined ()
p6eval rakudo cae7f9: OUTPUT«01»
*
On Sat Jun 26 11:43:15 2010, pmichaud wrote:
Now fixed in a579f8e. Closing ticket.
Pm
masonkramer How do I see if a thing does Callable?
masak rakudo: sub foo {}; say foo ~~ Callable
p6eval rakudo cae7f9: OUTPUT«1»
masak rakudo: sub foo {}; say foo.^does(Callable)
p6eval rakudo cae7f9:
One method-like thing that's come in handy for me as I've tinkered with the
language is .WHAT.
{ ... }.WHAT
Block()
AFAIK, you can use .WHAT on *any* term, because every term in Perl6 is an
object that is implemented by a class, and every class has a corresponding type
object (which is what
On Tue, Dec 28, 2010 at 12:38 AM, Mason Kramer mason.kra...@gmail.comwrote:
One method-like thing that's come in handy for me as I've tinkered with the
language is .WHAT.
{ ... }.WHAT
Block()
AFAIK, you can use .WHAT on *any* term, because every term in Perl6 is an
object that is
On Mon, Dec 27, 2010 at 18:18, Daniel Carrera dcarr...@gmail.com wrote:
On Mon, Dec 27, 2010 at 10:03 PM, Moritz Lenz wrote:
or
my $closure = $r1 $r2 ?? { %matches{$p1}++ } !! { %matches{$p2}++ };
# invoke it
$closure();
That's very cool. Perl 6 is a functional language with lambdas
On Mon, Dec 27, 2010 at 18:49, Daniel Carrera dcarr...@gmail.com wrote:
snip
That's cool. Thanks. I notice it works on numbers and string literals:
hello.WHAT # Str()
3.WHAT # Int()
3.3.WHAT # Rat()
pi.WHAT # Num()
(1+3i).WHAT # Complex()
But it seems to give very
Sorry.
TTIAR = Two Terms In A Row.
It's always a syntax error in Perl6, unlike Perl 5.
print, say, and sin as you've used them are not terms, actually. They're
expressions which happen to be function calls. You're calling .WHAT on their
return values. This is predictable going forward
On Tue, Dec 28, 2010 at 1:21 AM, Mason Kramer mason.kra...@gmail.comwrote:
Sorry.
TTIAR = Two Terms In A Row.
It's always a syntax error in Perl6, unlike Perl 5.
print, say, and sin as you've used them are not terms, actually. They're
expressions which happen to be function calls.
On Mon, Dec 27, 2010 at 19:41, Daniel Carrera dcarr...@gmail.com wrote:
snip
Hmm... I think this will only make sense to me if I ask you to define what a
term is, but I am sure that this term (pun intended) is difficult to
define. In particular, if a number like 5 is a term, then I would think
On Tue, Dec 28, 2010 at 2:06 AM, Chas. Owens On Mon, Dec 27, 2010 at All of
your examples are in fact terms. A term is a thing that is
considered one unit. So, numbers, strings, and variables are all
obviously terms. A function or method call that includes parentheses
is also a term. But
On Mon, Dec 27, 2010 at 8:50 PM, Daniel Carrera dcarr...@gmail.com wrote:
So TTIR just means that any two terms must be separated by something, like
an operator (2+5). Which basically is common sense and I'm actually
surprised to hear that in Perl 5 you could have two terms one after the
Announce: Niecza Perl 6 v1
To mark one month since the first announcement of Niecza, to be known
retroactively as v0, this is another announcement, to be known as v1.
Further announcements will occur at intervals on the last Monday of
each month.
You have my assurance that the 'v1' tag,
27 matches
Mail list logo