In the definition of cmp, S29 says the function returns
|Order::Increase|, |Order::Decrease|, or |Order::Same| (which numify to
-1, 0, +1). Shouldn't the enumerations and their numerical values be
listed in the same order?
Joe Gottman
This one's very nice. One question: what's the ~+ operator you
talk about in your discussion of prefix ~ ? I can't find any mention of
it in Synopsis 3.
Joe Gottman
: you might want to mention
the roundrobin function in the article on the zip function since the two
are very closely related.
Joe Gottman
bind to ANY arguments of
the second block? If the second block has two parameters it makes more
sense to me for the results to bind to the first parameter and nothing
to bind to the second parameter.
Joe Gottman
in
all subsequent elsif or else statements in the same if .. elsif .. else
clause, so you could do something like
if testa() - $a {say $a is true}
elsif testb() - $b say {$a is false and $b is true}
else say {Neither $a nor $b is true}
Joe Gottman
instead (for dot product).
Joe Gottman
Does the interpolating version of qw split a string into words before or
after it interpolates? So if I have
my $foo = 'Hello World';
my @bar = «$foo»;
does @bar equal ('Hello World') or ('Hello', 'World')?
Joe Gottman
In the Multiplicative Precedence section of S04, div is specified twice.
Joe Gottman
, 11])
Obviously both should be possible, and if we have a multislice with more
than 2 dimensions we should be able to iterate at any level. So what is
the default iteration level and how do we override?
Joe Gottman
Joe Gottman
Since Perl6 is going to have infix min and max operators, it might be
a good idea to have an infix minmax operator, defined by
$a minmax $b === ($a min $b), ($a max B); #2-element list
This would be especially useful as a reduction operator:
my ($min, $max) = [EMAIL PROTECTED];
Joe
Suppose I have a gather block that spawns several threads, each of which
calls take several times. Obviously, the relative order of items returned
from take in different threads is indeterminate, but is it at least
guaranteed that no object returned from take is lost?
Joe Gottman
{$_ += value;}
...
}
Joe Gottman
, it makes sense to have a block
that means not FIRST. I'm not sure about the name; besides REENTER, other
possible names would be SUBSEQUENT or NOTFIRST.
Joe Gottman
-Original Message-
From: Luke Palmer [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 17, 2006 8:44 PM
To: Perl6 Language List
Subject: Re: NEXT and the general loop statement
Wasn't NEXT supposed to do something tricky, such as being mutually
exclusive with LAST? I remember a
this:
repeat {
$num = rand;
print $num;
NEXT {print ',';}
LAST {print \n;}
} while $num 0.9;
If rand is a true random-number generator it would take a time machine to
determine whether to call NEXT or LAST.
(Sorry for the double post.)
Joe Gottman
Is a NEXT clause called before or after the update portion of a general loop
statement? For instance, consider the following code:
loop $n = 0; $n 5; ++$n {
NEXT {print $n;}
}
Is the output 01234 or 12345?
Joe Gottman
its behavior when
it is passed an empty list. Does it return undef or the empty string?
Joe Gottman
.
Joe Gottman
, you must use an explicit Creturn.
+
How does the sub keyword fit in here? Is there any difference between
the lines
return {say Hello World;};
and
return sub {say Hello World;};
?
Joe Gottman
; # same as '$args as Hash or Hash($args)
+$args; # same as '$args as Code or Hash($args)
Shouldn't this last one be
+$args; # same as '$args as Code or Code($args)
Joe Gottman
as our
Note that the third possibility here does not include a return type. Does
this imply that if we want to declare a subroutine with a return type we
have to declare it as either a my sub or an our sub?
Joe Gottman
version?
Joe Gottman
Suppose I have code that looks like this:
my ($x, $y, $z) = (1, 2, 3);
say sorted backward if ++$x ++$y ++$z;
Will $z be incremented even though the chained comparison is known to be
false after ++$x and ++$y are compared?
Joe Gottman
important.
Joe Gottman
?
while $x-- some_conditions( $x ) {...}
but
my $hashref = {};
Thanks,
These do two different things. {...} indicates that foo is just being
declared and the program should die if the code is ever executed. {} is an
empty subroutine that executes by doing absolutely nothing.
Joe
several
independent ones?
Joe Gottman
, $first_offset, @list) {...} # I'm not
sure how to write it.
Then your example would be
for contextual(3, -1, create_list_here() )- $last, $first, $next {
Joe Gottman
.
And now we're doing away with junctive types in favor of set types.
Will there be an operator for symmetric difference? I nominate (^).
Joe Gottman
{ $^a ~ $sep ~ $^b } ,
@list }
Just as Csum is probably implemented:
sub sum ([EMAIL PROTECTED]) { [+] 0, @list }
If this were the case, then
join '~', 'a', 'b', 'c'
would equal '~a~b~c' instead of 'a~b~c'
Joe Gottman
runtime, but I think this
just means that this just transforms compile-time errors to runtime errors.
Joe Gottman
trick of having the
dash be the first character in the class if you want to use a literal dash.
Joe Gottman.
, only those of the slice defined by @indices.
multi sub reduce (Code $expression : [EMAIL PROTECTED]) returns List
{
my $res;
for @values - $cur {
FIRST {$res = $cur; next;}
$res = $expression($res, $cur);
}
$res;
}
Joe Gottman
} will next {$_ =
false};
Joe Gottman
that it can be modified inside the
loop (by the update portion if nothing else), but does not alias a variable
it was initialized from.
Joe Gottman
-to-last
occurrence. So if we were to do something like
m:nth(-2)/foo/ # just a guess about the syntax.
on a string containing 4 foo's, then this would match the third foo.
Joe Gottman
-Original Message-
From: Larry Wall [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 02, 2004 8:41 PM
To: Perl6
Subject: Re: Reverse .. operator
On Thu, Sep 02, 2004 at 08:34:22PM -0400, Joe Gottman wrote:
: Is there similar shorthand to set @foo = (5, 3, 3, 2, 1) ? I know
5, the expression
$string =~ /(a+)(b+)/
returns a list of captured substrings in list context
Joe Gottman
None of the links for the perl6-language threads work.
Joe Gottman
There's something wrong with the mailing list archives at
http://dev.perl.org/perl6/lists/. I can get to this page OK, but when I
click on a link to the perl6-internals or perl6-language archives, I get a
This page cannot be displayed error.
Joe Gottman
);
or would I need the braces in this case?
Joe Gottman
:
say $_ = %hash{$_} given get_random_key();
Joe Gottman
missing?
Why not just use say
?$foo
Isn't the prefix ? operator designed specifically for this use?
Joe Gottman
Now that Apocalypse 12 is out, which one is Larry going to work on next?
Joe Gottman
here sent me, as well as reading a few more threads and references.
This will be the last update for some time
The zip operator is now the Yen sign (¥).
Joe Gottman
have another secondary sigil to mark a protected method or
attribute. I'd suggest the semicolon, but I'm afraid it would cause havoc
with the parser.
Joe Gottman
-hlE 'qx|`|`|readpipe' {} \; |
wc -l
123
`` gets used an awful lot
But that's in Perl 5, which is a glue language.
And Perl 6 isn't? I use backticks quite a bit in Perl, and I don't see
that changing if I upgrade to Perl 6.
Joe Gottman
think we should do so.
Joe Gottman
?
5) Would it be possible for me to create a user-defined operator that
does chaining?
Joe Gottman
}.self:sort();
Why not just do
@{$_} = sort @{$_} given $coderef.(argument).{hashelem};
Joe Gottman
start the loop the next
time.
Joe Gottman
How do you put a literal '{' or '}' into a format string in Perl 6? Do
you use a backslash?
Joe Gottman
they all are. Will the sort
end up being numerical or alphabetic?
Joe Gottman
$by : [EMAIL PROTECTED]) {...}
multi sub *sort( : [EMAIL PROTECTED]) { ...} # returns sort {$^a cmp $^b} @data
Joe Gottman
an unnecessary copy of
the array. It would be nice calling if sort (or reverse, or other similar
functions) in void context resulted in in-place modification of the array
that was input.
Joe Gottman
syntax mean both. I'm aware that using = instead of = will
eliminate the inconsistency, but not everyone has easy access to Unicode
keyboards.
Joe Gottman
- Original Message -
From: Larry Wall [EMAIL PROTECTED]
To: Perl6 [EMAIL PROTECTED]
Sent: Wednesday, January 21, 2004 2:51 PM
Subject: [perl] Re: Comma Operator
On Tue, Jan 20, 2004 at 08:12:28PM -0800, Jonathan Lang wrote:
: Joe Gottman wrote:
: About a month ago, a thread here
()
This works better when Dog::bark and Tree::bark are both needed but they
do different things.
Joe Gottman
- Original Message -
From: Luke Palmer [EMAIL PROTECTED]
To: Joe Gottman [EMAIL PROTECTED]
Cc: Perl6 [EMAIL PROTECTED]
Sent: Tuesday, January 06, 2004 9:34 PM
Subject: [perl] Re: Roles and Mix-ins?
Joe Gottman writes:
- Original Message -
From: Luke Palmer [EMAIL
default as a keyword (see the switch statement),
and having a trait with the same name as a keyword might confuse users
and/or the compiler.
Joe Gottman
is differentiating between an undef returned because
the arrays were of different sizes, and an undef returned because one of the
arrays contained an undef.
Joe Gottman
know enough C++ to know the difference between an lvalue
and an rvalue, but what the heck is a BValue?
Joe Gottman
, while call will not.
Joe Gottman
- Original Message -
From: Luke Palmer [EMAIL PROTECTED]
Joe Gottman writes:
3) Currying binds a function parameter to a value? Is there any way to
bind a function parameter to a variable? Consider the following code:
sub printNum(int $x) {print $x\n;}
my $foo = 0
reference. This would
probably have to be a different method than assuming. Maybe something like
printNum(int).bind(x = \$foo)
Joe Gottman
.
This would be an absolute necessity if you wanted to emulate C++, Java, or
any other strongly typed language.
Also, it could be useful for causing a compile-time error if someone types
something like
$z = swap($x, $y);
Joe Gottman
- Original Message -
From: Hanson, Rob [EMAIL PROTECTED]
To: 'Rod Adams' [EMAIL PROTECTED]; Perl 6 Language
[EMAIL PROTECTED]
Sent: Thursday, July 31, 2003 1:29 PM
Subject: RE: Perl 6's for() signature
Anyone but me feel the need for non-greedy
slurpy arrays? similar to non-greedy
more than once brings back painful memories of C-style macros.
Joe Gottman
difficult it would be to implement either of these
concepts. Also, if a parameter is deferred, would we need a new keyword to
say when to actually evaluate it?
Joe Gottman
should be like a my variable except that it is only initialized once and
is not destroyed when it goes out of scope.
Joe Gottman
- Original Message -
From: Damian Conway [EMAIL PROTECTED]
To: Perl6 [EMAIL PROTECTED]
Sent: Tuesday, March 11, 2003 9:35 PM
Subject: Re: A6: overloading multis on constness of parameters
Joe Gottman wrote:
Will it be possible in perl6 to overload multis on the const-ness
then the first getX would be
called, and if it were called on a non-const Foo object the second one would
be.
Joe Gottman
= 31);
Joe Gottman
- Original Message -
From: Uri Guttman [EMAIL PROTECTED]
To: Joe Gottman [EMAIL PROTECTED]
Cc: Perl6 [EMAIL PROTECTED]
Sent: Friday, January 03, 2003 10:06 PM
Subject: Re: my int( 1..31 ) $var ?
JG == Joe Gottman [EMAIL PROTECTED] writes:
JG Speaking of which, is there a run
There's something wrong with your links to the messages in the
documentation list. Whenever I click on one, I get the message Unable to
find thread. Please recheck the URL.
Joe Gottman
want. The capturing
parentheses ensure that we return the part of the string we want, and we
manually reset $pos to the correct position. This is easy to understand,
and very extensible.
Joe Gottman
Apocalypse 4 mentions unary '?' . Since this is used to force boolean
context, I would assume that it has the same precedence as unary '+' and
'_' which force numeric and string context respectively. By the way, has
anyone come up with a use for binary '?' yet?
Joe Gottman
is
performed only once. Unfortunately, I have no idea how this would be
implemented in Perl 6.
Joe Gottman
77 matches
Mail list logo