question on max | min op

2008-04-01 Thread Xiao Yafeng
I've read Synopsis and I wondered why to treat max and min as operator. IMHO, view them as list functions is more reasonable. Like below: @test.max is clearer than @test[0] max @test[1] or [max] @test. Any reply would be really appreciated and will much help me learn perl6. Thanks in advance!

new method question

2008-08-22 Thread Xiao Yafeng
There are no barewords in Perl 6, but it seems new method is an exception: class Dog { has $name; method bark () { say $name; } } my $p = Dog.new($name => 'boo'); $p.bark;#error! my $p = Dog.new( name => 'boo');

Re: how much detail can I get from caller.want?

2008-08-31 Thread Xiao Yafeng
On Sat, Aug 30, 2008 at 4:22 AM, Dave Whipp <[EMAIL PROTECTED]> wrote: > Lets say I want to find the 5th smallest element in an array. I might > write: > > @array.sort.[4]; > > How does the implementation of the sort function know that I just want to > 5th item (and thus choose an appropriate opt

operator vs function

2008-10-30 Thread Xiao Yafeng
Off the top of one's head, since there is no particular difference between an operator and a function, can I see a function as a operator: (1, 2, 3, 4) >>elems<<(2, 3, 4, 5) #(2, 2, 2, 2) (1, 2, 3, 4) >>shift<<(2, 3, 4, 5) #(2, 3, 4, 5) Moreover, can I see a subroutine as a oper

Re: File test ops as string methods

2008-11-08 Thread Xiao Yafeng
> > I've been thinking about that. One interesting ramification of > the current matching rule is that you could say either of: > >"foo".io ~~ :r :x > > or > >"foo" ~~ :io(:r :x) > > where .io is whatever your "casting" method of choice is for turning > a string into an object with the cor

some questions about S02(type)

2009-04-03 Thread Xiao Yafeng
1. Could I set multi-return type?like sub test as (Int, Str) {...} my (Int, Str) sub test {...} or my (Int|Num, Str) sub test{...} 2. set is unordered collection of values, subset is new type. People are apt to confuse th

Re: some questions about S02(type)

2009-04-04 Thread Xiao Yafeng
On Fri, Apr 3, 2009 at 10:52 PM, Moritz Lenz wrote: > Xiao Yafeng wrote: > > 1. Could I set multi-return type?like > > sub test as (Int, Str) {...} > > "as" is coercion - so to what would it coerce? Int or Str? How could the > compiler k

Re: some questions about S02(type)

2009-04-05 Thread Xiao Yafeng
/4/09, Timothy S. Nelson wrote: > On Sat, 4 Apr 2009, Xiao Yafeng wrote: > >>>> 3. Could I define primary key for a bag variable? >>> >>> All items in a Bag are "primary keys", but there's no data additional >>> data associated with it

Is there a way to bulky feed?

2009-07-09 Thread Xiao Yafeng
My question is: could I write below code in perl6: my @a = <1 2 3 4>; my @b[2]; for @a -> @b {;} # 2 loops like for @a -> $b[0],$b[1]{;} my @a = <1 2 3 4>; my @b; for @a -> @b {;} # 1 loop

Re: Is there a way to bulky feed?

2009-07-10 Thread Xiao Yafeng
On Fri, Jul 10, 2009 at 12:29 AM, yary wrote: > > > On Wed, Jul 8, 2009 at 8:45 PM, Xiao Yafeng wrote: > >> Any thoughts? >> > > First let's fix the whitespace in your post so it's easier to read- > > My question is: could I write below code in

Re: A new era for Temporal

2010-04-10 Thread Xiao Yafeng
Is Int a proper type? I hope I can use basic operation within Date and hours in perl6 like: Date -1/24 + 1/24/60 + Date On Fri, Apr 9, 2010 at 10:00 PM, Moritz Lenz wrote: > Am 09.04.2010 15:33, schrieb Dave Rolsky: > > On Thu, 8 Apr 2010, Carl Mäsak wrote: >> >> I do want to exp

Re: Rakudo Star - a useful, usable, "early adopter" distribution of Perl 6

2010-07-29 Thread Xiao Yafeng
Congratulations! On Thu, Jul 29, 2010 at 8:23 PM, Patrick R. Michaud wrote: > On behalf of the Rakudo and Perl 6 development teams, I'm happy to > announce the July 2010 release of "Rakudo Star", a useful and usable > distribution of Perl 6.  The tarball for the July 2010 release is > available f

Re: The trouble with awesome

2012-05-28 Thread Xiao Yafeng
On Sat, May 26, 2012 at 6:34 PM, Nicholas Clark wrote: > On Fri, May 25, 2012 at 08:44:30AM -0500, B. Estrade wrote: > > > Realistically, that's not going to happen. The internals of the Perl 5 > interpreter are not flexible enough to implement a lot of the features > that > Perl 6 has that Perl