Author: moritz
Date: 2009-05-27 09:47:44 +0200 (Wed, 27 May 2009)
New Revision: 26941
Modified:
docs/Perl6/Spec/S05-regex.pod
Log:
[S05] document action stubs
Modified: docs/Perl6/Spec/S05-regex.pod
===
---
yary wrote:
I'm a relative beginner at perl6, but pretty good with perl5 (and C
and a few others), so I read
for 0...@foo.elems
as saying Give me a list with one item longer then @foo, not give
me the indexes of @foo.
But a Perl non-beginner did make that mistake. The problem is that it
looks
Patrick R. Michaud wrote:
An even cleaner shortcut might be to use ^...@foo instead of ^...@foo.elems:
for ^...@foo - $k { do_something($k, @foo[$k]) }
Somewhat clearer could be:
for @foo.keys - $k { do_something($k, @foo[$k]) }
And some may prefer:
for @foo.kv - $k, $v {
I don't see how you could interpret the name elems as something
returning index of the last element. If your IRC interlocutor
confused @foo.elems with $#foo, then it seems more likely that they
were confused about the semantics of $#foo than of .elems , whose p5
equivalent is just scalar(@foo).
Em Ter, 2009-05-26 às 19:33 -0700, Jon Lang escreveu:
The exact semantics of autothreading with respect to control
structures are subject to change over time; it is therefore erroneous
to pass junctions to any control construct that is not implemented via
as a normal single or multi dispatch.
Hi,
As I recently mentioned in IRC, I'm going to give a talk about Perl 6 in
the International Free Software Forum in Porto Alegre, Brazil. For those
who don't know FISL, it's one of the biggest events in the world with ~
5k people attending (http://www.fisl.org.br).
This talk is not targetted
On Tue, May 26, 2009 at 04:38:21PM -0700, yary wrote:
perl4-perl5.8 or so had a variable that let you change the starting
index for arrays, so you could actually make the above work. But then
everyone who'd re-arranged their brains to start counting at 0, and
written code that has a starting
Andrew Whitworth wrote:
The issue mentioned in the Synopses is that junctions autothread, and
autothreading in a conditional could potentially create multiple
threads of execution, all of which are taking different execution
paths. At some point, to bring it all back together again, the
On Wed, May 27, 2009 at 7:05 AM, John Macdonald j...@perlwolf.com wrote:
On Tue, May 26, 2009 at 04:38:21PM -0700, yary wrote:
perl4-perl5.8 or so had a variable that let you change the starting
index for arrays, so you could actually make the above work. But then
everyone who'd re-arranged
On Tue, May 26, 2009 at 9:03 PM, Patrick R. Michaud pmich...@pobox.comwrote:
On Tue, May 26, 2009 at 06:43:40PM -0500, John M. Dlugosz wrote:
Daniel Carrera daniel.carrera-at-theingots.org |Perl 6| wrote:
The following construction doesn't do what a user might expect:
for 0...@foo.elems
Is it still a global in Perl 6?
It's not even global in perl5.10. perldoc says:
As of release 5 of Perl, assignment to $[ is
treated as a compiler directive, and cannot
influence the behavior of any other file. (That's
why you can only
Hi Daniel,
Sounds very interesting. Can you post slides? It'd be cool if the talk
was taped, like the Google tech talks. Will it be in English? I don't
speak Portuguese (I do speak Spanish and some German).
I'm planning to do a presentation to highlight the most impressive
aspects to Perl
Jonathan Scott Duff wrote:
Or perhaps
for 0...@foo.end - $k { ... }
@foo.keys may not be what the user wanted if @foo is a sparse array.
IIRC, you have to explicitly ask for the custom index in order to get
sparse array keys. By design, the normal index is never sparse;
only the custom
Em Qua, 2009-05-27 às 18:46 +0200, Daniel Carrera escreveu:
Hi Daniel,
Hi Daniel, :P
Sounds very interesting. Can you post slides? It'd be cool if the talk
was taped, like the Google tech talks. Will it be in English? I don't
speak Portuguese (I do speak Spanish and some German).
It will
Well, you really made me realize that I'm looking for things that make
me impressed, and probably I don't get impressed that easy nowadays ;)
Well, maybe you should relax your expectations. People who haven't
been following P6 development for the last near-decade may be
impressed by stuff that
Daniel Ruoso wrote:
I know this is not the approach you had in mind, but what do you think?
Well, you really made me realize that I'm looking for things that make
me impressed, and probably I don't get impressed that easy nowadays ;)
I understand. Your experience with Perl 6 makes you harder
Mark J. Reed wrote:
I really like the factorial example on the wiki page. That really
gets across the expressiveness of P6, without being too hard to
understand despite its brevity.
sub postfix:! { [*] 1..$^n }
say 5!;
WOW!! That *IS* cool. Can you explain to me how it works? I figured out
On Wed, May 27, 2009 at 1:42 PM, Daniel Carrera
daniel.carr...@theingots.org wrote:
sub postfix:! { [*] 1..$^n }
say 5!;
WOW!! That *IS* cool. Can you explain to me how it works? I figured out
postfix: myself, but the rest is obscure to me.
Key concepts:
1. placeholder variables. The ^
Daniel Carrera wrote:
sub postfix:! { [*] 1..$^n }
say 5!;
WOW!! That *IS* cool. Can you explain to me how it works? I figured out
postfix: myself, but the rest is obscure to me.
Here is another idea: Is it possible to declare a circumfix function
that calculates the magnitude of a vector?
Mark J. Reed wrote:
3. the reduction meta-operator [...] : [OP](@list) collects the
result of applying OP to the elements of the list in order. That is,
assuming foo() is a binary sub, [foo](1,2,3,4) =
foo(foo(foo(1,2),3),4). So [+](@list) generates a sum of the listed
values, [*]
Note that of the examples given, only Perl 6 and Common Lisp do two things
that help immensely simplify the result:
1. reference the built-in * operator directly, without having to wrap it in
a lambda expression;
2. actually name the function !
The Lisp version suffers from the lack of a
On Wed, May 27, 2009 at 02:21:40PM -0400, Mark J. Reed wrote:
On Wed, May 27, 2009 at 1:59 PM, Daniel Carrera
daniel.carr...@theingots.org wrote:
Wow... That's a foldl! In a functional language, that would be called a
fold.
In Haskell it may be called fold (well, foldl and foldr), but
Daniel Ruoso daniel-at-ruoso.com |Perl 6| wrote:
Please post impressive Perl 6 code snippets, we all know there are
several, and I really would like to give people some idea of why Perl 6
is so cool.
Of late, new languages have been created that are going backwards. That
is, they are
On May 27, 2009 01:52:58 pm Mark J. Reed wrote:
On Wed, May 27, 2009 at 1:42 PM, Daniel Carrera
daniel.carr...@theingots.org wrote:
sub postfix:! { [*] 1..$^n }
say 5!;
WOW!! That *IS* cool. Can you explain to me how it works? I figured out
postfix: myself, but the rest is obscure to
Mark J. Reed wrote:
In Haskell it may be called fold (well, foldl and foldr), but the
concept has has a variety of names. Two of the more common ones are
reduce and inject;
The terms I've seen are fold and reduce. The fold term is not just
from Haskell. I've seen it elsewhere. If you had
Mark J. Reed wrote:
Note that of the examples given, only Perl 6 and Common Lisp do two things
that help immensely simplify the result:
1. reference the built-in * operator directly, without having to wrap it in
a lambda expression;
2. actually name the function !
Yes, very neat. Haskell does
On Wed, May 27, 2009 at 3:38 PM, Daniel Carrera
daniel.carr...@theingots.org wrote:
The terms I've seen are fold and reduce. The fold term is not just
from Haskell. I've seen it elsewhere. If you had said inject I wouldn't
have known what you meant.
The name inject comes from Smalltalk,
Sounds like threads to me.
What I see that's different from common threads in other languages is
that they are all the same, rather than one master and many new threads
that have no context history above them. In Perl 6, every thread sees
the same dynamic scope as the original. It doesn't
On Wed, May 27, 2009 at 07:56:42PM +0200, Daniel Carrera wrote:
Here is another idea: Is it possible to declare a circumfix function
that calculates the magnitude of a vector?
$magnitude = |@vector|;
You know how in math, two vertical bars are a standard notation for
magnitude. Oh oh
Hi cool people,
the Amazing Perl 6 thread was amazing.
It reminded me how Perl 6 looks interesting and fun.
So...
how can I write properly, for some meaning of properly,
the Perl 6 equivalent of this:
http://search.cpan.org/dist/Games-BonDigi/
?
(
if it's not clear, you can run the
Sorry, only answered half of your question.
On Wed, May 27, 2009 at 07:56:42PM +0200, Daniel Carrera wrote:
Oh oh oh... is it possible to define a circumfix function for
the dot product? Something like:
$dot_product = @vector1,@vector2;
Is that possible? That would be uber-cool.
More
Cosimo ():
the Amazing Perl 6 thread was amazing.
It reminded me how Perl 6 looks interesting and fun.
So...
how can I write properly, for some meaning of properly,
the Perl 6 equivalent of this:
http://search.cpan.org/dist/Games-BonDigi/
?
Not sure if I grokked the whole set of rules,
Cosimo Streppone cosimo-at-streppone.it |Perl 6| wrote:
Hi cool people,
the Amazing Perl 6 thread was amazing.
It reminded me how Perl 6 looks interesting and fun.
So...
how can I write properly, for some meaning of properly,
the Perl 6 equivalent of this:
You're assuming he's using an instance of the built-in Array class.
I would think one reason for implementing your own class that does
Positional is to do something out of the ordinary.
So what exactly does Positional promise? I think it should be as
general as possible, and avoid thinking
Em Qua, 2009-05-27 às 23:46 +0200, Carl Mäsak escreveu:
Not sure if I grokked the whole set of rules, but here's a one-liner
that does it:
$ perl6 -e 'say (bon digi bon digi, bon xx ++$*n, digi xx
$*n).join(, ) while *'
It does, but it would be prettier if it was lazy...
for 2..* - $n {
(bon
You can write a sub to return the next step:
sub bondigi { state $n=1; return (Bon Digi Bon Digi, Bon xx $n,
Digi xx $n++); }
but I think an idiomatic Perl 6 solution would have a proper lazy
Iterator. How do we write one of those?
Larry Wall wrote:
$dot_product = @vector1,@vector2;
Is that possible? That would be uber-cool.
More likely just use
sub infix:· (@a,@b) { ... }
$dot_product = @vector1 · @vector2;
Thanks.
And for Daniel R. and other observers, how about this:
# Courtesy of Larry
sub infix:·
Mark J. Reed markjreed-at-gmail.com |Perl 6| wrote:
Well, you really made me realize that I'm looking for things that make
me impressed, and probably I don't get impressed that easy nowadays ;)
Well, maybe you should relax your expectations. People who haven't
been following P6
Mark J. Reed markjreed-at-gmail.com |Perl 6| wrote:
In Haskell it may be called fold (well, foldl and foldr), but the concept
has has a variety of names. Two of the more common ones are reduce and
inject; I believe Perl6 chose reduce for consistency with the Perl5
List::Util module. Common
Mark J. Reed markjreed-at-gmail.com |Perl 6| wrote:
On Wed, May 27, 2009 at 6:05 PM, John M. Dlugosz
2nb81l...@sneakemail.com wrote:
And APL calls it |¨ (two little dots high up)
Mr. MacDonald just said upthread that the APL reduce metaoperator was
spelled /. As in:
+/1 2 3
6
Here are a few of my favourite Perl 6 selling points:
* Compactness of expression:
say 'Hello, World!';
* Compactness of expression + semi-infinite data structures:
@fib = 1,1...[+]# The entire Fibonacci sequence
* Junctions make comparisons much more
On Wed, May 27, 2009 at 2:39 PM, John Macdonald j...@perlwolf.com wrote:
Historically, the name reduce was used (first?) in APL, which also
provided it as a meta-operator. op/ would use op to reduce the array
on the right of the meta-operator.
It's quite possible that APL was the first use of
Please see http://www.dlugosz.com/Perl6/web/info-model-1.html
and talk to me about it.
--John
Mark J. Reed markjreed-at-gmail.com |Perl 6| wrote:
Perhaps Perl 6 should not aspire to the expressiveness of APL. :) As
nice as it is that you can write Conway's Life in a one-liner(*), I
think that a little verbosity now and then is a good thing for
legibility
(*) life ←{↑1 ω⌵.^3 4=+/,‾1
44 matches
Mail list logo