tent values as those inconsistencies are found.
Most of them (all except all()) do not have to use the same value each
time they are evaluated.
If I'm wrong about this interpretation of this code, I apologize. But it
certainly fits my understanding of junctions, which has grown by leaps
and bounds over the last few weeks.
HTH,
-- Rod Adams
Luke Palmer wrote:
The object model that I'm working on actually identifies 2 and "2" as
the same object, indistinguishable in every respect.
Okay, that's fine, since C< 2 eq "2" > and C< 2 == "2" >. But what about
2.0 and "2.0"
#x27;m open to alternative syntaxs, this one was just there to illustrate
my point.
-- Rod Adams.
Larry Wall wrote:
On Tue, Mar 01, 2005 at 11:06:17PM -0600, Rod Adams wrote:
: Since the line between rules and subs is already blurring significantly,
: I want to blur it a little more. I want to write rules which can take
: parameters.
No problem. That's how the arguments to rules like
Patrick R. Michaud wrote:
On Tue, Mar 01, 2005 at 09:32:28PM -0800, Larry Wall wrote:
On Tue, Mar 01, 2005 at 11:06:17PM -0600, Rod Adams wrote:
: Since the line between rules and subs is already blurring significantly,
: I want to blur it a little more. I want to write rules which can take
We can now define 'equal':
sub equal ($x, $x) { 1 }
sub equal ($x, $y) { "" }
That's one of the MTOWs at least. The evaluation order of the patterns
still needs to be thought out.
I thought Larry already declared that we are not making Perl act like ML
(yet).
-- Rod Adams
Autrijus Tang wrote:
On Tue, Mar 08, 2005 at 04:55:28PM -0600, Rod Adams wrote:
I thought Larry already declared that we are not making Perl act like ML
(yet).
And that was re: type inferencing, not re: pattern matching. :)
Thanks,
/Autrijus/
Sorry about that. Comcast has decided I
ort name if it doesn't already exist,
and then perform an .add to that multi.
There are likely several rough edges in here, and I've by no means
convinced myself that this is the Right Thing, but I thought I'd throw
the idea out there to what others thought of it.
-- Rod Adams.
gt; and C< is Unbound >
more than those crufty C< where defined() >, but I don't think that
would mesh well with the rest of Perl6.
It's a lot more work to build than the equiv Prolog statement, but I
can't justify the level of effort it would take to define and implement
the auto-generation capabilities.
-- Rod Adams
Luke Palmer wrote:
Rod Adams writes:
Or you could avoid the global modifier and write your tests in <( )>
blocks instead... after all, that's what it's there for.
I *knew* I had seen a syntax for that before... I just didn't see it
when I scanned S05 for it.
I still
Thomas Sandlaß wrote:
Rod Adams wrote:
It seems to me that there are several advantages to making a group of
multi with the same short name a single object, of type
MultiSub|MultiMethod, which internally holds references to the all
the various routines that share that short name.
It doesn
Larry Wall wrote:
On Wed, Mar 09, 2005 at 06:19:25AM -0600, Rod Adams wrote:
: I was thinking more along the lines of :
:
:use MMD::Pattern;
:
:our &func is MMD::Pattern;
:
:multi func (...) {...}
:multi func (... ...) {...}
:multi func (... ... ...) {...}
:
:m
ral people seem
to be trying to get into Perl in some fashion or another. I can easily
wait until 6.2 for this to happen (for now at least).
-- Rod Adams
Ovid wrote:
--- Rod Adams <[EMAIL PROTECTED]> wrote:
I was just relaying the observation that the P6RE was fairly close to
being able to implement Logical Programming, which several people
seem to be trying to get into Perl in some fashion or another.
When I get a chance to talk to s
nt, in this case the say. What
you said might be construed as the junctions were still being threaded
when the the say and printf occurred.
HTH,
-- Rod Adams
David Storrs wrote:
On Wed, Mar 09, 2005 at 03:38:52PM -0600, Rod Adams wrote:
There lingers the case of:
use Foo; # from above, exports &bar is MMD::Random
multi sub bar {...}
Does this generate an error, since one could expect this particular &bar
to be Manhattan? Or does i
reated to make C<
Bar $f; > C< $f.Bar >? Or does it only work if there is no C< multi? sub
bar > in sight?
-- Rod Adams
Leopold Toetsch wrote:
Rod Adams <[EMAIL PROTECTED]> wrote:
It seems to me that there are several advantages to making a group of
multi with the same short name a single object, of type
MultiSub|MultiMethod, which internally holds references to the all the
various routines that share that
Sam Vilain wrote:
Rod Adams wrote:
I do not believe that is possible.
This is the "filtering" or "unification" behavior that people keep
wanting junctions to have, which they do not.
Aww! But what about all the great problems that could be expressed
with them? I know o
Dave Whipp wrote:
Rod Adams wrote:
I do not believe that you can create a 'lazy junction'. But I don't
recall the topic coming up before, so we'll have to wait for Damian
to come back unless someone else knows for certain.
My understanding is that all lists are conceptuall
David Storrs wrote:
On Thu, Mar 10, 2005 at 02:22:20PM -0600, Rod Adams wrote:
David Storrs wrote:
On Wed, Mar 09, 2005 at 03:38:52PM -0600, Rod Adams wrote:
use Foo; # from above, exports &bar is MMD::Random
multi sub bar {...}
Does this generate an error, since one could ex
Leopold Toetsch wrote:
Rod Adams <[EMAIL PROTECTED]> wrote:
Well
if 10 < $j < 1 { ... }
if 10 < $j { if $j < 1 { ... }}
Could easily wind up with the same opcodes.
No. In the first case $j is evaluated just once. In the second case it's
evaluated twice.
ti sub foo(A $a, B $b) {...}
This can be seen as questioning how to keep track of what multi's are in
scope at any given point in time, because you must dispatch amongst all
the multi's visible, regardless of the differing scope.
Sure. But the dispatch scheme is described in A
Leopold Toetsch wrote:
Rod Adams <[EMAIL PROTECTED]> wrote:
If I were to need a different policy for a given method .bar, I would
likely create something called .bar much like your "run_random_bar",
which then dispatches amongst methods I name something like ._bar .
I see
y, right?
If you want Set Theory.. use Sets. Or use some form of Logical
Programming which builds the sets implicitly for you, and does all the
filtering and backtracking you're asking for.
Both topics have been explored recently. The results of that exploration
can be summarized as:
- Sets would make a nifty module to have around.
- Integrating Logical Programming into Perl needs a lot more thought and
effort than will likely happen before 6.0.0. Modules grafting LP into
Perl and/or Parrot are welcome.
-- Rod Adams
ods
and classes, I don't see a penalty for supporting both forms. Consider:
$str.split($rule);
$rule.split($str);
I can see using both of those. But I can't see
$int.split($rule, $str);
as an alias for
$str.split($rule, $int_limit);
because I doubt that the limit will ever be the most important thing
about a split operation.
-- Rod Adams
like to keep something works on a whole list at once for
those cases where I'm doing several non-trivial expressions at once.
-- Rod Adams
Juerd wrote:
Rod Adams skribis 2005-03-12 17:41 (-0600):
Why not just rename C< sprintf > to C< format > and ditch printf and sayf?
Because format is almost as much typing as sprintf, and in many
circumstances needs both parens and quotes:
format("%03d %15s&qu
quot;as-ly" things:
print as MyBigInt, $foo, $bar;
ooh. Nice. I like that.
-- Rod Adams
Are the following all legal and equivalent?
for 1..10 -> $a, $b { say $a, $b };
for 1..10 { say $^a, $^b };
sub foo ($a, $b) { say $a, $b };
for 1..10 &foo;
What happens with:
for 1..10 -> [EMAIL PROTECTED] { say @a };
-- Rod Adams
Luke Palmer wrote:
Rod Adams writes:
Are the following all legal and equivalent?
for 1..10 -> $a, $b { say $a, $b };
for 1..10 { say $^a, $^b };
sub foo ($a, $b) { say $a, $b };
for 1..10 &foo;
Almost. The last one should be:
for 1..10, &foo;
Doh! I knew th
ure about above is that I think you'd have to
say C< [...]».key».as($pattern) > to get it working correctly.
(4) use square brackets in
this instance (to make sure my list doesn't form a parameter list to
C)?
Yes, but whitespace between the "say" and "(" should do the trick as
well. Might generate a warning, however.
-- Rod Adams
s Num
Cosine (radians). $_ if omited.
=item multi sub exp (?Num) returns Num
=item multi method Num::exp() returns Num
Exponent or inverse natural log. $_ if omited.
-- Rod Adams
Larry Wall wrote:
On Sun, Mar 13, 2005 at 01:15:52AM -0600, Rod Adams wrote:
: Plan of attack:
:
: I'm using a recent copy of Perl 5's perlfunc as a very rough template.
: At some point, I'll drudge through the A's and S's to look for functions
: new to Perl 6. I'
a review of "Obsolete" to make sure they actually
are gone.
-- Rod Adams
And then internally dispatch on what is defined and undefined.
Personally I like
multi sub cos (Num ?$x = $CALLER::_, Num|Str +$base) returns Num
better. You can do:
our &cos<> := &cos<>.assuming:base('degrees');
to make cosine "degrees only" for your current package.
-- Rod Adams
Ashley Winters wrote:
On Sun, 13 Mar 2005 23:42:41 -0600, Rod Adams <[EMAIL PROTECTED]> wrote:
Ashley Winters wrote:
For documentary purposes, can we make that $radians?
multi sub cos (Num +$degrees) returns Num {
return cos :radians($degrees * PI / 180);
}
my Num $x = cos :degre
Larry Wall wrote:
On Sun, Mar 13, 2005 at 01:15:52AM -0600, Rod Adams wrote:
: =item multi sub cos (?Num) returns Num
:
: =item multi method Num::cos () returns Num
It would be nice if we could just say the first implies the second.
I guess what that effectively means is that even if you take
ule of:
You can't declare a function into ::*. You have to create it
elsewhere, and bind it in.
Therefore, as I go through S29, I'll assign all functions to some
module. I'll be using the P5/CPAN hierarchy as a strong guideline.
We can then discuss what gets bound into ::*, an
Leopold Toetsch wrote:
Rod Adams <[EMAIL PROTECTED]> wrote:
While that's a nice feature to have in general, I feel better about
going ahead and predefining that the builtins are already members of
Num, Str, Array, Hash for the shear performance and documentation values
of it.
How am I supposed to define a signature that says "A scalar that refers
to a hash or array element, but do not evaluate or autovivify the element"?
Or are these two are now strictly methods without functional forms?
-- Rod Adams
signature? It's not specifically mentioned in
A/S04, but it makes sense it would be allowed along with ?%.
-- Rod Adams
the same thing, as do
@a[3;4]
@a[3][4]
And then operate the Perl 5 way, where C would return an array ref.
#2 seems like the way to go, but I'm open to other suggestions.
I'm especially interested in hearing people's view on how C
should work with multi-dim arrays.
-- Rod Adams
I'm trying to define zip(), but can't come up with a signature for a
function that returns a lazy list of lvalues, but the list itself is not
lazy?
As a second matter, can you declare a type for the elements of a slurpy
array?
So far I have:
multi sub zip (Array [EMAIL PROTECTED]) returns List
ing that I can define just the base multi sub, without
all the associated multi methods
-- Rod Adams
hout actually making it one, but maybe we should make
a separate precedence level for it to keep list op precedence "pure".
I don't see the point of making them list ops. Leaving them at that
precedence level makes sense, but leave them unary. For a list version,
you can write C or C to do the same thing.
-- Rod Adams
Thomas Sandlaß wrote:
Rod Adams wrote:
How am I supposed to define a signature that says "A scalar that
refers to a hash or array element, but do not evaluate or autovivify
the element"?
I'll make a guess: Ref of Int of Array.
This assumes Int has a polymorphic subtype that allow
a named package. Not all
functions are guaranteed to be imported into the global package
C<::*>. In addition, the list of functions imported into C<::*> will be
subject to change with each release of Perl. Authors wishing to
"Future Proof" their code should either specifically import the
functions they will be using, or always refer to the functions by their
full name.
-- Rod Adams
ness and deprcate it completely?
I hadn't thought about it yet. I almost definitely would have come to
that conclusion.
Yes, please.
Done.
-- Rod Adams
Larry Wall wrote:
On Tue, Mar 15, 2005 at 02:25:01PM -0600, Rod Adams wrote:
: In Perl 6, all builtin functions belong to a named package. Not all
: functions are guaranteed to be imported into the global package
: C<::*>. In addition, the list of functions imported into C<::*> will
I vote for axing C in favor of C and C.
-- Rod Adams
.
:'s have been added into signatures where they belong.
various other clean ups.
Comments welcome.
-- Rod Adams
) > take care of those cases?
Sure, it's line noise, but do we really need a new keyword for something
that's "relatively rare"?
Especially when that keyword is likely to confuse people a lot more than
the application of two unary operators?
-- Rod Adams
ke $expression
.( splice(@values, 0, $expression.arity) );
}
}
}
-- Rod Adams
ar2 -> $_ is rw {
s/.../.../;
s/.../.../;
}
though
given $var1 {
s/.../.../;
s/.../.../;
}
is nice.
)
But if you don't see the need for lvalueing the elements coming out of
C, that certainly makes things easier. :-)
-- Rod Adams
yms in all other ways but "autoflatten".
As far as linguistics go, "for" makes a suitable replacement for "given"
in my head. It's just a very heavily loaded term when you leave English
and enter CS-speak.
-- Rod Adams
bit
more flexible.
Thanks to Joe for pointing out the missing functions. They've been added
locally and will be posted shortly. (Any others?)
-- Rod Adams
Luke Palmer wrote:
Rod Adams writes:
In S29, I currently have C as:
multi sub grep (Any|Junction $test : [EMAIL PROTECTED]) returns List {
gather {
for @values -> $x {
take $x if $x ~~ $test;
}
}
}
That's the listop form. I was referring to the method form:
multi
Larry Wall wrote:
On Wed, Mar 16, 2005 at 01:22:06PM -0600, Rod Adams wrote:
: Larry Wall wrote:
:
: >On Tue, Mar 15, 2005 at 12:28:15PM -0700, Marcus Adair wrote:
: >: Isn't saying "false doesn't exist" like saying, "dark doesn't exist"?
: >: Why
C, and leave it up to you to
determine what the operator form of it should be, if any.
for zip :shortest 1...; @foos; @bars {...}
-- Rod Adams
Aaron Sherman wrote:
On Wed, 2005-03-16 at 03:18, Rod Adams wrote:
I just posted a fresh copy of S29 to:
http://www.rodadams.net/Perl/S29.pod
http://www.rodadams.net/Perl/S29.html
From there:
=head2 Obsolete
=item chop
Chop removes the last character from a string. Is that
Aaron Sherman wrote:
On Thu, 2005-03-17 at 18:06 -0600, Rod Adams wrote:
This is a SEPARATE need from the need for a repeatable, standard PRNG,
and should always operate off of the best source of entropy available to
the program. Right now, that's /dev/urandom (for non-blocking hybri
Aaron Sherman wrote:
On Wed, 2005-03-16 at 02:18 -0600, Rod Adams wrote:
I just posted a fresh copy of S29 to:
http://www.rodadams.net/Perl/S29.pod
http://www.rodadams.net/Perl/S29.html
Couple more points from the docs (mostly to the list, but some to you,
Rod):
multi sub grep (Any
Aaron Sherman wrote:
On Thu, 2005-03-17 at 20:47 -0500, Aaron Sherman wrote:
Methods on numeric values (should be defined as pseudo-methods on
unboxed numbers):
chr
hex
oct
Sigh... well, now I know what Ctrl-Return does in Evolution :-/
Ok, so what I was getting at was that th
other languages That's evil. I like it :-)
btw, has some syntax been created for "punt this over to Parrot, in
language X"?
eval q:to:0 /EOB/ :lang('PIR');
...
EOB
eval $=DATA :lang('python');
eval loadfile 'foo.pl' :lang('ponie')
Larry Wall wrote:
On Thu, Mar 17, 2005 at 10:31:07PM -0600, Rod Adams wrote:
: Aaron Sherman wrote:
: >>Methods on numeric values (should be defined as pseudo-methods on
: >>unboxed numbers):
: >>
: >> chr
: >> hex
: >>oct
: >>
: >>
view" type casting
Larry was rumbling about. Simply re-view your string as an "Array of
Chars", (bytes/codepoints/graphemes) and then pop or shift.
Let's see where that thread ends up first.
-- Rod Adams
it did in Perl 5.
Some side points:
It is an error to do things like C with strings of different
levels, but not different encodings.
level and encoding should default to whatever the source code was
written in, if known.
C and C should be able to be replaced with C views of
compact structs (see S09).
C kills C. Or at least buries it very deeply, without oxygen.
Comments?
-- Rod Adams
urns an lvalue or not, which my
C<.as> does.
There's likely room for unification of the two ideas.
-- Rod Adams
h positions within those
strings, and what a given integer position means can vary greatly with
level. But even there I suppose that we could force the target's level
onto the term, and make all positions relative to the target, and it's
level.
As for the exact syntax of the coercion, I'm open to suggestions.
-- Rod Adams
finish discussing on p6l how strings
in general are handled.
But the string funcs are next on my todo list. :-)
-- Rod Adams
Larry Wall wrote:
On Sat, Mar 19, 2005 at 11:03:40PM +1100, Andrew Savige wrote:
: 2) Documentation.
:Where is the slurp built-in documented? I couldn't find it
:in any of the Synopses (including Rod Adams' recent S29).
:In desperation, I googled and found CPAN Perl6::
Larry Wall wrote:
On Wed, Mar 16, 2005 at 11:49:12PM -0600, Rod Adams wrote:
: I haven't gotten a solid answer on when and how Perl will autogenerate
: methods from subs.
In general I don't think of it as autogeneration at all, but as
failover to a different dispatcher. I can't
e `if $x == 1 | 2`, this
is one of those things that a newbie to programming would ask "why can't
I do that?"
For the record, this is the currently what I plan on doing in S29 unless
I hear a strong objection or something better.
-- Rod Adams
$this {
when Even { nothing };
when Prime { ... };
default{ ... };
}
As a side question, I assume that there's a predicate form of "when",
but it's not mentioned.
given $this {
nothing when Even;
when Prime { ... };
default{ ... };
}
-- Rod Adams
hogonality strikes again.
I've renamed C to C in S29. (new post soon)
-- Rod Adams
I'm thinking C and C should be strictly Code Point level
activities, but I'm not sure.
They likely need to be renamed, in any event, to better reflect the fact
that everything is Unicode these days.
-- Rod Adams
C is an odd sort of function. AFAIK, it's the only optimization
hint that we have.
Will the P6RE even use this information, and is it worth keeping?
My gut feeling tells me that it will be useful again around 6.2, and we
should keep it around until then as a potential no-op.
Comments?
-
s
not something you can do with slices, unless you start stiching the
prefix, replacement, and suffix slices on your own, which requires a lot
of copying that could be skipped.
-- Rod Adams
Luke Palmer wrote:
Rod Adams writes:
C is an odd sort of function. AFAIK, it's the only optimization
hint that we have.
Will the P6RE even use this information, and is it worth keeping?
My gut feeling tells me that it will be useful again around 6.2, and we
should keep it around until
Larry Wall wrote:
On Sat, Mar 19, 2005 at 11:03:40PM +1100, Andrew Savige wrote:
: 2) Documentation.
:Where is the slurp built-in documented? I couldn't find it
:in any of the Synopses (including Rod Adams' recent S29).
:In desperation, I googled and found CPAN Perl6::
Larry Wall wrote:
On Sun, Mar 20, 2005 at 09:08:08PM -0600, Rod Adams wrote:
: I propose creating a no-op function "nothing" that can be used
: here or anywhere else you specifically wish to do nothing at all.
:
: given $this {
:when Even { nothing };
:when Prime { ... };
:
o.
But you can't solve
nothing while something();
with a comment. Well, not gracefully. Not without inline comments, at least.
There seems to be some support for just saying:
{} while something();
I would also hope the compiler could optimize away something like:
sub nothing () {};
-- Rod Adams
of those creates an Array of
Arrays, and the other just an Array. In other words, using @ instead of
$ puts a "Array of" in front of the supplied type.
This makes sense when one considers orthogonality with C and
C. But it's easy to get tripped up it.
-- Rod Adams
(Who needs m
allowing the user to add more as they
see fit (EBCDIC, etc).
Level and Encoding can be mixed and matched independently, except for
the combos that don't make any sense.
-- Rod Adams
t I might
just be dense on this.
-- Rod Adams
ust a "toy" for solving a few minor problems like
specifying characters.
- It's fairly comprehensive in that it should be easy to write
functions which mutate the units intelligently, and know when to flag a
type mismatch.
- It all goes away by default for the user who doesn't want to bother
with it.
-- Rod Adams
Larry Wall wrote:
On Sat, Mar 26, 2005 at 02:37:24PM -0600, Rod Adams wrote:
: Please convince me your view works in practice. I'm not seeing it work
: well when I attempt to define the relevent parts of S29. But I might
: just be dense on this.
Well, let's work through an example
lay problem. I seriously doubt the someone working with a rtl
language would ever wish to count the characters ltr. And note that we
are calling the positions "start" and "end", not "left" and "right".
If I'm missing something basic here, let me know.
-- Rod Adams
pair is more useful.)
Most likely a pair.
Now if I could only find some more time to work on S29. I've been making
progress (slowly) on getting the string functions written up, but life
seems to be conspiring against rapid progress.
-- Rod Adams
list of lists is still just a list. An array
of arrays is a different story.
So this behavior is what I meant to say in S29. If it's unclear, I'm
open to suggestions.
-- Rod Adams
(who still needs more time to work on S29. Looks like I'll have some in
a few weeks. In the meant
e individual chars. Consider:
$a = $b = "All good boys go to heaven.";
substr($a,9,3) = "girl";
$b[9..11] = "girl"[];
say "A: $a";
say "B: $b";
A: All good girls go to heaven.
B: All good girs go to heaven.
-- Rod Adams
I see them as solving all kinds of corner cases.
Unfortunately, I don't have a solid proposal handy, which has kept me
from posting it. But since there is some interest in this, I'll throw
the concept out there, and see if anyone else has a good idea what they
should look like, and exactly how they should work.
-- Rod Adams
;, and
that was on Feb 22, one can be left to assume that Damian is suffering
from a very long week. Poor Damian. Sadly, my recent weeks have felt as
if they were 2 months long. Here's to a return of the 7 day
week!
-- Rod Adams
's a possibility and no one seems to be disputing those, so
I apologize if I just need to be pointed to where methods v functions
is clarified.
Many of them will happen in S29, since there's an odd duality that class
based multi subs exist in. I don't pretend to fully understand
David Wheeler wrote:
But the first person to write <[a...]> gets what's comin' to 'em.
Is that nothing (since '.' lt 'a'), or everything after 'a'?
-- Rod Adams
or the block,
but that starts getting to look a lot like
{my $sql = '...'} CATCH {default};
Except that one is run-time, the other compile-time.
So one could interpret this thread as a cry for a compile-time exception
handler. I see some interesting uses for this in conjunction with
C, but I doubt I'm seeing the whole story.
-- Rod Adams
n core.
Didn't S09 take care of that w/ the [ ; ; ] syntax?
-- Rod Adams
$j];# \(b..d)
$ju = juncture @ar[$j]; # 'b'|'c'|'d'
@v = %hash{$k}; # (1,7)
%v = %hash{$k}.kv; # (a=>1,c=>7)
$v = %hash{$k}; # \(1,7)
$jv = juncture %hash{$k}; # 1|7
Am I way off base here?
What would you propose
@v[all(any(4,5),one(1,2,3),none(7,8,9))]
return?
-- Rod Adams
rforming magical disappearing
acts all over the place, and the ^ ties in with the $^x of parameters.
As for shortcuts to $OUTER::_, perhaps $-, if it's not put to some
better usage, but anything beyond that is getting too obscure for common
usage.
-- Rod Adams
101 - 200 of 243 matches
Mail list logo