On Tue, Sep 06, 2005 at 06:19:01PM +0300, Yuval Kogman wrote:
: On Tue, Sep 06, 2005 at 13:28:24 +, Luke Palmer wrote:
:
: This should still work:
:
: sub map (code, [EMAIL PROTECTED]) {
: gather {
: my @args = @list.splice(0, code.arity);
: take
On 9/7/05, Damian Conway [EMAIL PROTECTED] wrote:
Luke wrote:
In that last case though, this is not equivalent to the above:
given code.arity {
when 2 { code(1,2) }
when 1 { code(1) }
}
That may be a little... surprising. Still, it's fixed to
On 9/7/05, Luke Palmer [EMAIL PROTECTED] wrote:
And this is based on lexical expansion. Which is cool. In fact, once
upon a time I was going to propose that junctions are a purely lexical
entity, expanded into greps and whatnot by the compiler; that you
can't ever stick them in variables.
On 9/7/05, Brent 'Dax' Royal-Gordon [EMAIL PROTECTED] wrote:
Here's a Real Live Perl 6 module I wrote recently. I've omitted a few
magic portions of the code for clarity.
Thanks for real live perl 6 code. It's always nice to have real examples.
However, I'm arguing for logical stability
HaloO,
Luke wrote:
I just proved that is not transitive.
I can do that for every boolean operator that Perl has. They no
longer have any general properties, so you can't write code based on
assumptions that they do. In particular, testing whether all
elements in a list are equal goes
Luke wrote:
Okay, fair enough. The reason that I thought it was surprising is
because 1 and 2 are usually orthogonal patterns.
It depends what they're doing. Matched against a regex like /[12]/ they're
not orthogonal either.
Junctions are logical travesty,
Well, that's very emotive, but
On 9/8/05, Damian Conway [EMAIL PROTECTED] wrote:
Luke wrote:
Okay, fair enough. The reason that I thought it was surprising is
because 1 and 2 are usually orthogonal patterns.
It depends what they're doing. Matched against a regex like /[12]/ they're
not orthogonal either.
Well,
H. The arity of a given multi might be 3 or 4 or 5.
If *only* there were a way to return a single value that was simultaneously
any of 3 or 4 or 5.
Oh, wait a minute...
Damian
On 9/3/05, Damian Conway [EMAIL PROTECTED] wrote:
H. The arity of a given multi might be 3 or 4 or 5.
If *only* there were a way to return a single value that was simultaneously
any of 3 or 4 or 5.
Oh, wait a minute...
Well, we'd better document that pretty damn well then, and provide
Luke Palmer skribis 2005-09-06 13:28 (+):
Well, we'd better document that pretty damn well then, and provide
min_arity and max_arity, too.
Won't junctions do Array, then? I think foo.arity.max would be very
intuitive, and likewise, for @foo.arity { ... }
Juerd
--
On Tue, Sep 06, 2005 at 13:28:24 +, Luke Palmer wrote:
This should still work:
sub map (code, [EMAIL PROTECTED]) {
gather {
my @args = @list.splice(0, code.arity);
take code([EMAIL PROTECTED]);
}
}
multi sub foo ( ... ) {
On a related note:
Suppose I have a function with a non-obvious arity: I might, in a
desperate attempt to find billable hours, describe the arity as a trait:
sub sandwich($bread, $meat, $cheese, $condiment1, $qty1, ...)
does arity ({ 3 + 2 * any(1..Inf); });
That's cougheasy enough for
Luke wrote:
Well, we'd better document that [junctive arity values] pretty damn
well then, and provide min_arity and max_arity, too.
Unnecessary. The Cmax and Cmin builtins should be overloaded to Just
Work on junctive values:
if min code.arity 2 {...}
This is one of those places
On Fri, Sep 02, 2005 at 17:56:39 +0200, Ingo Blechschmidt wrote:
Hi,
multi foo ($a) {...}
multi foo ($a, $b) {...}
say foo.arity;
# die? warn and return 0? warn and return undef? return 1|2?
A multi sub is a collection of variants, so it doesn't have arity,
each
On 03/09/05, Yuval Kogman [EMAIL PROTECTED] wrote:
A multi sub is a collection of variants, so it doesn't have arity,
each variant has arity.
I'd say it 'fail's.
But if the reason you're calling `foo.arity` is to answer the
question Can I call this sub with three arguments? then that kind of
On Sun, Sep 04, 2005 at 00:27:39 +1000, Stuart Cook wrote:
if foo.accepts(:pos(1..3) :namedfoo bar :code) { ... }
I prefer this api... Arity is ambiguous will multiply variadic args.
We have any number of positionals, nameds, and zero, one or two
slurpies.
None of this really answers the
On 9/3/05, Stuart Cook [EMAIL PROTECTED] wrote:
On 03/09/05, Yuval Kogman [EMAIL PROTECTED] wrote:
A multi sub is a collection of variants, so it doesn't have arity,
each variant has arity.
I'd say it 'fail's.
But if the reason you're calling `foo.arity` is to answer the
question Can
On Fri, Sep 02, 2005 at 05:56:39PM +0200, Ingo Blechschmidt wrote:
: Hi,
:
: multi foo ($a) {...}
: multi foo ($a, $b) {...}
:
: say foo.arity;
: # die? warn and return 0? warn and return undef? return 1|2?
How 'bout undef but 1..2? :-)
Larry
18 matches
Mail list logo