At 9:08 AM -0800 3/9/05, Larry Wall wrote:
My other quibble is that you seem to be prone to stating things in the
negative for at least two of your three tests here:
subtype KeyName of Str where { $_.defined and $_ ne '' and $_ !~ m/\W/ }
and it seems to me that you could simplify all that to j
--- Rod Adams <[EMAIL PROTECTED]> wrote:
> But come to think of it, it almost definitely makes more sense to
> port Prolog or some other LP engine to Parrot, and then intermingle
the
> languages at that level. I don't think very many of us have fully
> grasped what Parrot can do for Perl yet.
I'
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 someone
--- 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 someone about logic p
Larry Wall wrote:
I suspect it's another one of the many things we just try to
stay within hailing distance of without trying to solve for 6.0.0.
That's cool.
I was just relaying the observation that the P6RE was fairly close to
being able to implement Logical Programming, which several people
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 (... ... ...) {...}
:
:multi func2
At 10:03 AM -0800 3/9/05, Larry Wall wrote:
On Wed, Mar 09, 2005 at 06:51:43PM +0100, Thomas Sandlaß wrote:
: Larry Wall wrote:
: >and it seems to me that you could simplify all that to just
: >
: >subtype KeyName of Str where { m/^\w+$/ }
: >
: >If that succeeds, you know it's defined and non-
On Wed, Mar 09, 2005 at 08:56:22AM -0700, Luke Palmer wrote:
: I was decently insane last night. This generator stuff probably isn't
: going anywhere. It's too abstract, and not precise enough, to be a
: truly powerful part of the language.
I suspect it's another one of the many things we just t
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 (... ... ...) {...}
:
:multi func2 (...) {...}
:
On Wed, Mar 09, 2005 at 12:22:37PM +0100, Juerd wrote:
: > my $a = [EMAIL PROTECTED];
: > my $a = *(1,2,3); # or is this a syntax error?
: > my $a = *(list 1,2,3);
: > my $a = *[1,2,3];
:
: I hope this will emit some kind of too-many-arguments warning in
: addition to assigning 1 to $a.
N
On Wed, Mar 09, 2005 at 06:51:43PM +0100, Thomas Sandlaß wrote:
: Larry Wall wrote:
: >and it seems to me that you could simplify all that to just
: >
: >subtype KeyName of Str where { m/^\w+$/ }
: >
: >If that succeeds, you know it's defined and non-null.
:
: My view is that typing strings by
On Tue, Mar 08, 2005 at 05:49:54PM -0800, chromatic wrote:
: On Tue, 2005-03-08 at 17:39 -0800, Larry Wall wrote:
:
: > On Tue, Mar 08, 2005 at 03:23:14PM -0800, chromatic wrote:
:
: > : I could make the argument that it should be possible to decorate an
: > : object with a role. If that means g
Larry Wall wrote:
and it seems to me that you could simplify all that to just
subtype KeyName of Str where { m/^\w+$/ }
If that succeeds, you know it's defined and non-null.
My view is that typing strings by means of patterns should always
exhaust the string as the above pattern does. I can ima
On Wed, Mar 09, 2005 at 05:56:25PM +0200, wolverian wrote:
: Hi all,
:
: reading [AS]02 left me a bit unclear on list construction. Specifically,
: as comma still seems to be the list constructor, what do these produce:
:
: my $a = (1, 2); # a List object of 1, 2?
Same as
my $a
Luke Palmer wrote:
Keep in mind that the two following definitions are equivalent:
class A { method foo () {...} }
multi sub foo (A $a) {...}
Except for attribute access, I think.
For public attrs the accessor is not used and private ones are available:
class A
{
has $.pub = "pub";
ha
On Wed, Mar 09, 2005 at 09:13:27AM -0800, Larry Wall wrote:
: sub foo ( Int $bar where { $_ == 0 } ){ ... }
Well, I'm not sure about that syntax. It might have to be either
sub foo ( Int where { $_ == 0 } $bar ){ ... }
or
sub foo ( $bar of Int where { $_ == 0 } $bar ){
On Wed, Mar 09, 2005 at 02:15:56PM +0200, wolverian wrote:
: On Mon, Mar 07, 2005 at 08:40:19AM -0800, Larry Wall wrote:
: > Here are some alternatives you don't seem to have considered:
:
: [...]
:
: > my Str sub greeting (Str $person) is export {
: > "Hello, $person";
: > }
: >
On Tue, Mar 08, 2005 at 10:29:30PM -0800, Darren Duncan wrote:
: The biggest change is that, upon a re-reading Synopsis 12 (and 9)
: that was inspired by your above comment, I created some subtypes
: which I now use everywhere; the declarations and some examples of use
: are:
:
: subtype KeyN
Hi all,
reading [AS]02 left me a bit unclear on list construction. Specifically,
as comma still seems to be the list constructor, what do these produce:
my $a = (1, 2); # a List object of 1, 2?
my $a = (1); # Int 1?
my $a = (1,); # List of 1?
my ($a)
Rod Adams writes:
> I wasn't intending it to be junctive. I was just noting that you needed
> separate holders for subs and methods, since you shouldn't be able to
> stuff a method into a multi sub.
Keep in mind that the two following definitions are equivalent:
class A { method foo () {...
Rod Adams writes:
> >
> >You could do all of this with a library of rules.
> >
> > / $:= )> /
> >
> >
> I don't think this does what I want. In this, &generate returns a rule
> or string of some kind, matches the string being tested, captures what
> matches, and then binds the capture to $.
Aldo Calpini writes:
> my @a = [1,2,3]; # or does it make @a[0] = (1,2,3)?
Yes, @a[0] = [1,2,3];
> and I have absolutely no clue about the following:
>
> my *$a = @a;
> my *$a = [EMAIL PROTECTED];
> my *$a = (1,2,3);
> my *$a = [1,2,3];
Those are all illegal. You need to use binding
On Tue, Mar 08, 2005 at 10:29:30PM -0800, Darren Duncan wrote:
> [...]
>
> By using subtypes in this way, I could remove a lot of explicit input
> checking code from my methods, which is great. Also, the "where
> clause" is not being repeated for every argument or attribute or
> variable decla
Juerd wrote:
my @a = 1,2,3;
my $a = 1,2,3;
These are
(my @a = 1), 2, 3;
(my $a = 1), 2, 3;
if I understand precedence correctly. (S03)
right, sure. I vaguely remember something about comma instead of parens
being the list constructor, but maybe it was just in my fantasy.
and thanks for
On Mon, Mar 07, 2005 at 08:40:19AM -0800, Larry Wall wrote:
> Here are some alternatives you don't seem to have considered:
[...]
> my Str sub greeting (Str $person) is export {
> "Hello, $person";
> }
>
> my Str
> sub greeting (Str $person) is export {
> "Hello,
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't hav
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 want the :z modifier for
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't have to be junctive becaus
Aldo Calpini skribis 2005-03-09 12:12 (+0100):
> my @a = 1,2,3;
> my $a = 1,2,3;
These are
(my @a = 1), 2, 3;
(my $a = 1), 2, 3;
if I understand precedence correctly. (S03)
> my $a = [EMAIL PROTECTED];
> my $a = *(1,2,3); # or is this a syntax error?
> my $a = *(list 1,2,3);
>
I was trying to implement unary * (list flatten or "splat" operator) in
pugs yesterday, and I came to the conclusion that I really don't grok
how context works in Perl6 (I also really don't grok Haskell, but this
is another story...).
if I understand correctly, all these are equivalents:
my @
HaloO Luke,
you wrote:
[..] The *method* is the one that knows everything,
not the object. So definitions on subtypes of general types only check
for those subtypes when dispatching to the methods defined in them.
I stand corrected. Lax usage of Any is fair. Defining subtypes
of general types and
Darren Duncan <[EMAIL PROTECTED]> wrote:
> A question: Would "has PkgNameArray @.tmpl_set_nms;" do what I
> expect, where the array as a whole is the sub-type, or would it make
> an array where each element is the sub-type?
I think this declares an array of PkgNameArrays, but "has
@.tmpl_set_nms i
Thomas Sandlaà writes:
> Luke Palmer wrote:
> >But we always have enough knowledge to optimize the hell out of this,
> >and they're not not handwavy "we can probably" optimizations. They're
> >real, and they're pretty darn easy.
>
> I fully agree. But I like to add that a single 'where' on genera
Rod Adams writes:
> Indeed, a great deal of logical testing can be performed with the
> current P6RE definition.
>
> For instance:
>
>rule Equal ($x, $y) {{ $x ~~ $y or fail }};
>rule Substr (Str $str, Str $in) {{ $in ~~ /<$str>/ or fail }};
>rule IsAbsValue (Num $x, Num $y) {
>
Luke Palmer wrote:
But we always have enough knowledge to optimize the hell out of this,
and they're not not handwavy "we can probably" optimizations. They're
real, and they're pretty darn easy.
I fully agree. But I like to add that a single 'where' on general
types like Int, Str or even Any can s
Leopold Toetsch writes:
> Luke Palmer <[EMAIL PROTECTED]> wrote:
>
> > I think we should replace our multimethod system with a more general
> > pattern matcher, a "variadic multimethod" system of sorts. Multimethods
> > need to be variadic anyway, because we want pugs's quicksort example to
> > w
Luke Palmer <[EMAIL PROTECTED]> wrote:
> I think we should replace our multimethod system with a more general
> pattern matcher, a "variadic multimethod" system of sorts. Multimethods
> need to be variadic anyway, because we want pugs's quicksort example to
> work.
I'd not say replace. The dispa
There's been rumblings on this list lately about making Perl perform more
Logic based programming functions, a la Prolog. Having done some work
with Prolog in academia, I fully understand why this is desirable.
It occurs to me that underlying functionality of Prolog is moderately
similar to the P6R
38 matches
Mail list logo