Re: scalar/array contexts in perl5 vs. perl6

2005-12-04 Thread Sam Vilain
On Sun, 2005-12-04 at 13:10 -0500, Mike Li wrote: > what is a good translation of the following C into perl6? > [...] >int x = 0; int y[] = {1, 2, 3, 4, 5, 6, 7, 8, 9}; y[x++]++; /* line > that matters */ [...] > > > in perl5, i would've written something like: > > my $x = 0; my @y = 1..9

Re: Some thoughts on threading

2005-12-11 Thread Sam Vilain
On Thu, 2005-12-08 at 17:16 +0100, Ron Blaschke wrote: > The Free Lunch Is Over: A Fundamental Turn Toward Concurrency in Software." > [1] He starts with "The biggest sea change in software development since > the OO revolution is knocking at the door, and its name is Concurrency." Perhaps have a

Re: handling undef - second draft

2005-12-18 Thread Sam Vilain
On Sat, 2005-12-17 at 17:27 -0800, Darren Duncan wrote: > 3. A flag that says we know that some operation failed, such as would > be exploited in the " err " > situations. > This concept is like an exception which isn't thrown but returned. "Dropping" an exception, perhaps? :) > 1. I accept th

Re: Obsoleting "require 'Some/Module.pm'"

2005-12-19 Thread Sam Vilain
On Mon, 2005-12-19 at 14:58 +0200, Gaal Yahas wrote: > Can we make this work? > > my $mod = "Some::Module"; > require $mod; What about casting it to a package; require ::{$mod}; (not sure if the syntax is quite right) Sam.

Re: Another dotty idea

2006-04-10 Thread Sam Vilain
Damian Conway wrote: >I'm not enamoured of the .# I must confess. Nor of the #. either. I wonder >whether we need the dot at all. Or, indeed, the full power of arbitrary >delimiters after the octothorpe. > > Agreed. >What if we restricted the delimiters to the five types of balanced brackets

Re: Another dotty idea

2006-04-10 Thread Sam Vilain
Larry Wall wrote: >On Tue, Apr 11, 2006 at 12:26:13PM +1200, Sam Vilain wrote: >: This does mean that if you comment out blocks with s/^/#/, you mess up on: >: >: #sub foo >: #{ >: # if foo { } >: #} > >Well, actually, that still works. > > Oh, true :-) B

Re: Another dotty idea

2006-04-10 Thread Sam Vilain
Larry Wall wrote: >: But this fragment dies: >: >: #sub foo >: #{ >: # bar { } unless baz >: #} >I don't see how that's different at all from the first example. > > “#sub foo” is parsed as a comment token “#{ # bar { }” is the next comment token then we get “unless baz” Unless you are b

Re: using the newer collection types

2006-05-04 Thread Sam Vilain
Darren Duncan wrote: >Speaking a little more technically, a Relation has 2 main components, >its heading and its body. The heading is a set of 0..N keys (called >"attributes" in relation-land), and the body is a set of 0..N >Mappings (called "tuples" in relation-land), where they set of keys

Re: using the newer collection types

2006-05-05 Thread Sam Vilain
Darren Duncan wrote: >>>Is there a reference for the meaning of these methods? >>> >>> >>There are many written references to these methods; just type >>"relational algebra" into Google. >> >> > >I will add that the first hit on such a search, the Wikipedia page on >relational algebra

Re: using the newer collection types

2006-05-07 Thread Sam Vilain
Darren Duncan wrote: >>Also, I don't agree with the notion of a "header" of each relation. It >>has a type for each tuple item, sure, but "header" just sounds like the >>sort of thing you want in a ResultSet, not a Relation. >>Sam. >> >> >A relation's heading is essentially the definition of t

Re: ACID transactions for in-memory data structures

2006-05-17 Thread Sam Vilain
Rob Kinyon wrote: >On 5/15/06, Audrey Tang <[EMAIL PROTECTED]> wrote: > > >>Rob Kinyon wrote: >> >> >>>I'm pretty sure it wouldn't be very feasible to do this natively in >>>P5. But, would it be possible to do it natively in P6? As in, >>>supported within the interpreter vs. through some sor

Re: packages vs. classes

2006-05-22 Thread Sam Vilain
Larry Wall wrote: >'Course, I left out everything about prototype objects there... > >The name Foo also (in context) represents an uninitialized object of >the class in question. Any object, initialized or not, can get at >its type handlers by saying > >Foo.meta >$foo.meta > >and, in fact

Re: hyp-op examples of a Bag type in S03

2006-05-22 Thread Sam Vilain
Darren Duncan wrote: > $bag1 >>-<< 1; # Bag(2,7,[1,Seq(8,2)],7) > $bag2 >>-<< (1,1,1,1); # probably the same > $bag3 >>-<< (1,1,2,1); # ? > > Bag's won't .does(Array) or .does(Coll[Seq,...]), so that hyperoperator won't work - if anything it would try to add the (1,1,1,1) li

Re: [svn:perl6-synopsis] r9307 - doc/trunk/design/syn

2006-05-25 Thread Sam Vilain
[EMAIL PROTECTED] wrote: >+In either case this sets the C property of the container to C. >+Subroutines have a variant of the C property, C, that >+sets the C property instead. The C property specifies >+a constraint to be checked upon calling C that, unlike the C >+property, is not advertized as

Re: Concurrency: hypothetical variables and atomic blocks

2006-05-31 Thread Sam Vilain
Jonathan Lang wrote: >How does an atomic block differ from one in which all variables are >implicitly hypotheticalized? I'm thinking that a "retry" exit >statement may be redundant; instead, why not just go with the existing >mechanisms for successful vs. failed block termination, with the minor

Re: Concurrency: hypothetical variables and atomic blocks

2006-05-31 Thread Sam Vilain
Daniel Hulme wrote: >>How does an atomic block differ from one in which all variables are >>implicitly hypotheticalized? >> >> >I assume that the atomicness being controlled by some kind of lock on >entry, it also applies to I/O and other side-effecty things that you >can't undo. > The lock o

Re: Perl5 -> Perl 6 Translations Design Document

2006-06-05 Thread Sam Vilain
Sage La Torra wrote: >Hello all, > >I'm the student picking up on the translation work lwall started. Since the >perl 5 parser is more or less complete, I've headed straight to the >translation work. I'm going to be taking on the translations a few at a >time, starting with the easiest translation

Re: easier duck typing in .can

2006-06-17 Thread Sam Vilain
Yuval Kogman wrote: Since CANDO is a multimethod, IMHO this can be safely extended to allow: $object.can(Class); $object.can(Role); to better support duck typing. Why would you not use .does or .isa there? Are you wanting this to go through all of the Class/Role's methods

Re: lvalue functions and lvalue parameters

2006-06-20 Thread Sam Vilain
Jonathan Scott Duff wrote: >> sub cond(Bool $c, $a, $b) is rw { >> if $c return $a else return $b; >> } >> >> Will this fail because $a and $b are not rw? If so, will it fail at run- >> or compile-time? What about this: >> > That looks like it should be a compile-time failure to me. > De

Re: features of and declaring Mapping|Set|Hash values|variables

2006-06-29 Thread Sam Vilain
Darren Duncan wrote: > 1. Looking at the language in Synopsis 6 for data types, I see: > > Set Unordered Seqs that allow no duplicates > JunctionSets with additional behaviours > PairSeq of two elements that serves as an one-element Mapping > Mapping Pair

Re: binding operators and related introspection

2006-07-17 Thread Sam Vilain
Darren Duncan wrote: > But I would also like to have an easy way to change all bindings to > the same variable at once to point to the same new variable. > [...] >my $x = 'foo'; >my $y = 'bar'; >my $z := $x;# $x and $z point to same 'foo', $y to a 'bar' >$z.rebind_all_aliases_

Re: META vs meta

2006-09-12 Thread Sam Vilain
Larry Wall wrote: > : There is currently a mismatch between S12 and Pugs. The former specifies > $obj.META, the latter has implemented $obj.meta. > > .META is more correct at the moment. > Does making it all upper caps really help? It's still a pollution of the method space, any way that you

Re: Udates to "Perl 6 and Parrot Essentials"

2006-09-21 Thread Sam Vilain
Agent Zhang wrote: > On 9/19/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > >> Have there been any significant changes since the 2nd. edition of "Perl 6 >> and Parrot Essentials"? >> >> If so, where should I look for a summary? >> >> > > Yes, there have. That book is completely out of d

Re: Capture sigil

2006-09-21 Thread Sam Vilain
Larry Wall wrote: > Okay, I think this is worth bringing up to the top level. > > Fact: Captures seem to be turning into a first-class data structure > that can represent: > > argument lists > match results > XML nodes > anything that requires all of $, @, and % bits. > Also;

Nitpick my Perl6 - parametric roles

2006-09-25 Thread Sam Vilain
Anyone care to pick holes in this little expression of some Perl 6 core types as collections? I mean, other than missing methods ;) role Collection[\$types] { has Seq[$types] @.members; } role Set[::T = Item] does Collection[T] where { all(.members) =:= one(.members); };

Re: Nitpick my Perl6 - parametric roles

2006-09-25 Thread Sam Vilain
TSa wrote: >> role Collection[\$types] { >>has Seq[$types] @.members; >> } > This is a little wrapper that ensures that collections have got > a @.members sequence of arbitrary type. This immediately raises > the question how Seq is defined. > [...and later...] > Are you sure that the u

Re: Mutability vs Laziness

2006-09-25 Thread Sam Vilain
Aaron Sherman wrote: > Carried over form IRC to placeholder the conversation as I saw it: > > We define the following in S06 as immutable types: > > ListLazy Perl list (composed of Seq and Range parts) > Seq Completely evaluated (hence immutable) sequence > Range

Re: Nitpick my Perl6 - parametric roles

2006-09-26 Thread Sam Vilain
Darren Duncan wrote: > Unless I'm mistaken, you may be going about this the wrong way. > > Within a system that already has an underlying > set-like type, the Junction in this case, a test > for uniqueness is (pardon any spelling): > >all(@items).elements.size === @items.size > > The all() wi

Re: Nitpick my Perl6 - parametric roles

2006-09-26 Thread Sam Vilain
Miroslav Silovic wrote: > TSa wrote: > >>> role Set[::T = Item] does Collection[T] where { >>> all(.members) =:= one(.members); >>> }; >>> >> Nice usage of junctions! >> >> > > But buggy - one means *exactly* one. So for an array of more than 1 > element, all(@array) never

Re: Nitpick my Perl6 - parametric roles

2006-09-26 Thread Sam Vilain
TSa wrote: > HaloO, > > Sam Vilain wrote: > >> perl -MPerl6::Junction=one,all -le '@foo=qw(1 2 3 4); print "yes" if >> (all(@foo) eq one(@foo))' >> yes >> > > But does it fail for duplicates? I guess not because junctions

Re: Nitpick my Perl6 - parametric roles

2006-09-26 Thread Sam Vilain
Darren Duncan wrote: >> Perhaps, but then Junctions might not assume elements have equality or >> identity operations defined. >> > As I recall, every type in Perl 6 has an equality and identity > operation defined because the Object superclass provides one. If > nothing else, the type's eq

Re: class interface of roles

2006-10-01 Thread Sam Vilain
TSa wrote: > HaloO, > > is this subject not of interest? I just wanted to start a > discussion about the class composition process and how a > role designer can require the class to provide an equal > method and then augment it to achieve the correct behavior. > Contrast that with the need to do th

Re: [perl #41478] [PATCH] add Test::More::skip()

2007-02-13 Thread Sam Vilain
t;> common than skipping a number of tests without a message? >> > > This is my guess too. Probably need to as Schwern to find out the original > (Perl 5) reason. > > multi-sub? skip string skip int, string Sam. > Nicholas Clark > > > >Fr

Re: [svn:parrot-pdd] r17312 - trunk/docs/pdds/draft

2007-03-04 Thread Sam Vilain
[EMAIL PROTECTED] wrote: > (When you extend an existing class, it actually creates > +a new class, that replaces the old class in the Namespace, but the old > +class can't be thrown away if it has objects instantiated in it. The old > +objects still point to the old class and do their method resolu

Re: [PATCH]: tools for using Subversion branches; ops2c.pl refactored

2007-03-04 Thread Sam Vilain
James Keenan wrote: > The patch attached is really two patches in one: > > 1. A resubmission in patch form of my refactoring of tools/build/ > ops2c.pl into lib/Parrot/Ops2c/Utils.pm and lib/Parrot/Ops2c/ > Auxiliary.pm, along with a test suite in t/tools/ops2cutils/. > > 2. 4 new files which p

Re: [PATCH]: tools for using Subversion branches; ops2c.pl refactored

2007-03-04 Thread Sam Vilain
James Keenan wrote: >> Why are these two changes tied together? Surely if you have a capable >> feature branching system this is not necessary. > I submitted individual patches and new files last week for the > refactoring of ops2c.pl. Following the instructions in docs/ > submission.pod, I ed

Re: [PATCH]: tools for using Subversion branches; ops2c.pl refactored

2007-03-04 Thread Sam Vilain
chromatic wrote: >> Mixing things together is everything that you are attempting to resolve. >> Why are you making excuses for not achieving this? >> > > I don't think that's entirely fair. James's experiment here is an > experiment, > and if it fails we can learn something from it. > Y

Patches for review

2007-03-12 Thread Sam Vilain
I've submitted a set of changes to the ML for review. Do you really want tickets for all of those changes? Some of them are quite minor. Sam.

Re: Patches for review

2007-03-12 Thread Sam Vilain
t; Well, look at that, they didn't arrive :) Obviously something on mx.develooper.com thought the e-mails weren't generated by a human or something. hmm. Does anyone know if there's a public trashed bin or something for the perl.org lists? Sam. > Regards. > > On Mar

[PATCH 6/6] [lib] Test::More - add isa_ok()

2007-03-13 Thread Sam Vilain
Add the isa_ok() method --- runtime/parrot/library/Test/More.pir | 80 ++ t/library/test_more.t| 38 2 files changed, 117 insertions(+), 1 deletions(-) diff --git a/runtime/parrot/library/Test/More.pir b/runtime/parrot/library

[PATCH 4/6] [library/Test::More] add isnt() to test inequality - ints only

2007-03-13 Thread Sam Vilain
refactor the is() :multi for integers into a _cmp_ok() function, and then use that to provide is() and isnt() --- runtime/parrot/library/Test/More.pir | 53 -- t/library/test_more.t| 16 +- 2 files changed, 59 insertions(+), 10 deletions(

[PATCH 3/6] [lib/Test::More] base comparison type on expected, not received PMC type

2007-03-13 Thread Sam Vilain
The type of the 'left' argument was being used for the selection of which comparison function to use. This does not agree with the typical usage of the second argument to is() to mean the expected value (as in English). --- runtime/parrot/library/Test/More.pir |8 1 files changed, 4

[PATCH 5/6] [library/Test::More] add isnt() to test inequality - str and float

2007-03-13 Thread Sam Vilain
Continue the previous factoring out of the comparison and test function, by adding _cmp_ok() for other types --- runtime/parrot/library/Test/More.pir | 233 +++--- t/library/test_more.t| 39 ++- 2 files changed, 222 insertions(+), 50 deletions(-)

[PATCH 5/6] [library/Test::More] add isnt() to test inequality - str and float

2007-03-13 Thread Sam Vilain
Continue the previous factoring out of the comparison and test function, by adding _cmp_ok() for other types --- runtime/parrot/library/Test/More.pir | 233 +++--- t/library/test_more.t| 39 ++ 2 files changed, 222 insertions(+), 50 deletions(-)

[PATCH 3/6] [lib/Test::More] base comparison type on expected, not received PMC type

2007-03-13 Thread Sam Vilain
The type of the 'left' argument was being used for the selection of which comparison function to use. This does not agree with the typical usage of the second argument to is() to mean the expected value (as in English). --- runtime/parrot/library/Test/More.pir |8 1 files changed, 4

[PATCH 0/6] A round of Test/More updates

2007-03-13 Thread Sam Vilain
This patch series extends the Test/More.pir library in various ways. I'm sending it this way because it's trivial for me to do so, and potentially makes the patches easier for the list to review and comment on particular portions. Sam.

[PATCH 6/6] [lib] Test::More - add isa_ok()

2007-03-13 Thread Sam Vilain
--- runtime/parrot/library/Test/More.pir | 80 ++ t/library/test_more.t| 38 - 2 files changed, 117 insertions(+), 1 deletions(-) diff --git a/runtime/parrot/library/Test/More.pir b/runtime/parrot/library/Test/More.pir index f9f

[PATCH 1/6] [library] Test::More: use hllmacros.pir in man page example

2007-03-13 Thread Sam Vilain
Use current best practice for importing symbols in the example. --- runtime/parrot/library/Test/More.pir | 26 -- 1 files changed, 12 insertions(+), 14 deletions(-) diff --git a/runtime/parrot/library/Test/More.pir b/runtime/parrot/library/Test/More.pir index 8441b25..

[PATCH 2/6] [t/library/Test::More] move skip test to be first

2007-03-13 Thread Sam Vilain
The tested output from test_skip() depends on the number of tests that ran in the unrelated sections before it. Tidy this up. --- t/library/test_more.t | 16 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/t/library/test_more.t b/t/library/test_more.t index 7bae

[PATCH 1/6] [library] Test::More: use hllmacros.pir in man page example

2007-03-13 Thread Sam Vilain
Use current best practice for importing symbols in the example. --- runtime/parrot/library/Test/More.pir | 26 -- 1 files changed, 12 insertions(+), 14 deletions(-) diff --git a/runtime/parrot/library/Test/More.pir b/runtime/parrot/library/Test/More.pir index 8441b25..5

[PATCH 2/6] [t/library/Test::More] move skip test to be first

2007-03-13 Thread Sam Vilain
The tested output from test_skip() depends on the number of tests that ran in the unrelated sections before it. Tidy this up. --- t/library/test_more.t | 16 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/t/library/test_more.t b/t/library/test_more.t index 7baef

[PATCH 4/6] [library/Test::More] add isnt() to test inequality - ints only

2007-03-13 Thread Sam Vilain
refactor the is() :multi for integers into a _cmp_ok() function, and then use that to provide is() and isnt() --- runtime/parrot/library/Test/More.pir | 53 -- t/library/test_more.t| 16 ++ 2 files changed, 59 insertions(+), 10 deletions

[PATCH 0/6] A round of updates to Test::More

2007-03-13 Thread Sam Vilain
This patch series extends the Test/More.pir library in various ways. I'm sending it this way because it's trivial for me to do so, and potentially makes the patches easier for the list to review. Sam.

Re: [PATCH 1/6] [library] Test::More: use hllmacros.pir in man page example

2007-03-13 Thread Sam Vilain
Will Coleda wrote: > FYI, all six patches were just opened as tickets. > 01:33 <@Coke> do me a favor. Forward each of them to RT and open a ticket. HA! I followed this instruction, "moments" before you forwarded them. Where "moments" is a time period defined by the perl.org mailserver. So, 41

Re: [perl #41818] [PATCH */4]: [t/op] add tests for string memory layout

2007-03-14 Thread Sam Vilain
Jerry Gay via RT wrote: >> +.end >> + >> +#.constant STRINGINFO_STRSTART 2 >> +#.constant STRINGINFO_BUFLEN 3 >> +#.constant STRINGINFO_FLAGS4 >> +#.constant STRINGINFO_BUFUSED 5 >> +#.constant STRINGINFO_STRLEN 6 >> >> # Local Variables: >> # mode: pir >> -- >> 1.5.0.2.21.gdcde2 >> >>

[PATCH] [library/Test::More] add isnt() to test inequality - str and float

2007-03-15 Thread Sam Vilain
Continue the previous factoring out of the comparison and test function, by adding _cmp_ok() for other types --- runtime/parrot/library/Test/More.pir | 233 +++--- t/library/test_more.t| 39 ++- 2 files changed, 222 insertions(+), 50 deletions(-)

[PATCH] [t/library/Test::More] move skip test to be first

2007-03-15 Thread Sam Vilain
The tested output from test_skip() depends on the number of tests that ran in the unrelated sections before it. Tidy this up. --- t/library/test_more.t | 16 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/t/library/test_more.t b/t/library/test_more.t index 7baef

[PATCH] [library] Test::More: use hllmacros.pir in man page example

2007-03-15 Thread Sam Vilain
From: Sam Vilain <[EMAIL PROTECTED]> Use current best practice for importing symbols in the example. --- runtime/parrot/library/Test/More.pir | 26 -- 1 files changed, 12 insertions(+), 14 deletions(-) diff --git a/runtime/parrot/library/Test/More.pir b/runtime/

[PATCH] [lib/Test::More] base comparison type on expected, not received PMC type

2007-03-15 Thread Sam Vilain
The type of the 'left' argument was being used for the selection of which comparison function to use. This does not agree with the typical usage of the second argument to is() to mean the expected value (as in English). --- runtime/parrot/library/Test/More.pir |8 1 files changed, 4

[PATCH] [library/Test::More] add isnt() to test inequality - ints only

2007-03-15 Thread Sam Vilain
refactor the is() :multi for integers into a _cmp_ok() function, and then use that to provide is() and isnt() --- runtime/parrot/library/Test/More.pir | 53 -- t/library/test_more.t| 16 +- 2 files changed, 59 insertions(+), 10 deletions(

[PATCH] [lib] Test::More - add isa_ok()

2007-03-15 Thread Sam Vilain
--- runtime/parrot/library/Test/More.pir | 80 ++ t/library/test_more.t| 38 - 2 files changed, 117 insertions(+), 1 deletions(-) diff --git a/runtime/parrot/library/Test/More.pir b/runtime/parrot/library/Test/More.pir index f9f

Re: [PRE-RELEASE] Release of 0.0.7 tomorrow evening

2002-07-22 Thread Sam Vilain
se". I notice that DBI no longer supports Perl releases <5.6. Seems enough people are happy that 5.005 is obsolete. -- Sam Vilain, [EMAIL PROTECTED] WWW: http://sam.vilain.net/ 7D74 2A09 B2D3 C30F F78E GPG: http://sam.vilain.net/sam.asc 278A A425 30A9 05B5 2F13 I r

Re: S29: punt [pwned!]

2005-05-12 Thread Sam Vilain
Rod Adams wrote: It looks like I'm going to have to punt on finishing S29. On behalf of pugs committers, we will gladly adopt this task, which is in the pugs repository already at docs/S29draft.pod, as well as having a set of foundation classes that correspond to all these object methods in docs/sr

Re: Quick question: '1.28' * '2.56'

2005-05-17 Thread Sam Vilain
Rob Kinyon wrote: If that's the case, then if I change a variable that isa Str (that isa Num), does it change what it inherits from? Please don't use "inherits" when talking about these core types. Classical inheritance just doesn't work with the varied sets of numbers. All those stories you were

Re: Quick question: '1.28' * '2.56'

2005-05-17 Thread Sam Vilain
Larry Wall wrote: : pugs> '1.28' * '2.56' : 3.2768 : What is (or should be) going on here here? : [1] role NumRole { : method infix:<*> returns Num (NumRole $x, NumRole $y: ) { ... } : } : Str.does(NumRole); : [3] multi sub prefix:<+> (Str $x) returns Num { ... } : multi s

Re: Default precedence level of user defined infix ops

2005-05-18 Thread Sam Vilain
Luke Palmer wrote: And how do I explicitly define the precedence? Using the `tighter`, `looser`, and `equiv` traits. You specify precedence in terms of the precedence of other existing ops. sub infix:<.>(&f, &g) is looser(&infix:<+>) {...} This is interesting. So, infix:< > is similar to Hask

Re: reduce metaoperator on an empty list

2005-05-19 Thread Sam Vilain
Edward Cherlin wrote: Here is the last answer from Ken Iverson, who invented reduce in the 1950s, and died recently. file:///usr/share/j504/system/extras/help/dictionary/intro28.htm [snip] Thanks for bringing in a little history to the discussion. Those links are all local to your system; do yo

Re: reduce metaoperator on an empty list

2005-05-19 Thread Sam Vilain
Stuart Cook wrote: In Haskell, there is a distinction between foldl and foldl1 (similar remarks apply to foldr/foldr1[1]): The former (foldl) requires you to give an explicit 'left unit'[2], which is implicitly added to the left of the list being reduced. This means that folding an empty list will

Re: Complex Arithmetic

2005-05-19 Thread Sam Vilain
Edward Cherlin wrote: There was a discussion of the principal value of square root on this list some time back, making the point that for positive [...] It turns out that the domain and range and the location of the cut lines have to be worked out separately for different functions. Mathemat

Re: [S29] uniq

2005-05-19 Thread Sam Vilain
Mark Overmeer wrote: 'uniq' differs from 'sort' because there is no order relationship between the elements. A quick algorithm for finding the unique elements in perl5 is sub uniq(@) { my %h = map { ($_ => 1) } @elements; keys %h; } ...and an even quicker one is: use Set::Object;

Junctive and Higher order Types

2005-05-19 Thread Sam Vilain
Hi all, While trying to convert Haskell statements like this to Perl 6: data Cxt = CxtVoid -- ^ Context that isn't expecting any values | CxtItem !Type -- ^ Context expecting a value of the specified type | CxtSlurpy !Type -- ^ Context expecting multiple values of the

Re: Sets

2005-05-26 Thread Sam Vilain
Patrick R. Michaud wrote: > The continuing exchanges regarding junctions, and the ongoing tendency > by newcomers to think of them and try to use them as sets, makes > me feel that it might be worthwhile to define and publish a standard > C class and operations sooner rather than later in Perl 6

Re: function signatures?

2005-05-29 Thread Sam Vilain
Ingo Blechschmidt wrote: Are signatures going to be an exposed first class object in Perl 6? I hope so, too. ~&foo.signature; # Signature objects should stringify to a canonized form, e.g.: # ~sub (Str $bar, CoolClass $z where {...}) {...}.signature ==> # 'Str $bar, ANONCLASS(0xDEADBEEF)

Re: Strongly typed containers?

2005-05-30 Thread Sam Vilain
Yuval Kogman wrote: > We already have the Set class, how do we say what it contains? > class Set { >has $.type; >method members returns $.type () { ... } > } > my Set of Int $s = Set.new; # is this how you call it? You are describing "Higher Order" types, also called Generic Algebraic Dat

Re: Unicode Operators cheatsheet, please!

2005-05-31 Thread Sam Vilain
Rob Kinyon wrote: I would love to see a document (one per editor) that describes the Unicode characters in use and how to make them. The Set implementation in Pugs uses (at last count) 20 different Unicode characters as operators. I have updated the unicode quickref, and started a Perlmonks dis

Re: date and time formatting

2005-05-31 Thread Sam Vilain
Rob Kinyon wrote: What I'm trying to get at isn't that DateTime's API should be preserved. I'm saying that the concept of DateTime should be ported. Core or not core - it doesn't matter. When use'd (or installed), it should override now() (and anyone else we can think of) to return an object that

Re: "returns" and context

2005-05-31 Thread Sam Vilain
Rod Adams wrote: How do I specify the signature of a context-sensitive function? sub foo() returns (what?) { return want ~~ Scalar ?? cheap_integer_result :: List_of_Sheep; } I suspect a typed junction would look like : "Junction of Int|Str". Not quite. AIUI that means a Junct

Software Transactional Memory interaction with Garbage Collection

2005-06-03 Thread Sam Vilain
Hi all, While I must start this post out by saying that I've never implemented either STM or a garbage collector, during a discussion on #parrot (is that channel logged?), a similarity between the two processes occurred to me. Would this be an adequate expression of a generational Garbage C

Re: What the heck is... wrong with Parrot development?

2005-06-06 Thread Sam Vilain
Fagyal Csongor wrote: With all respect, I think this is a very important thing which needs attention, and I hope that you will help us to clarify the situation. I am pretty sure Dan did not leave because he had a bad day - we know he Dan's position was very stressful, he had people from all s

Re: reduce metaoperator on an empty list

2005-06-06 Thread Sam Vilain
Roger Hale wrote: This is why I would rather the o -> [o] circumfixion left [o] an infix, not prefix operator. I would rather be explicit about my identity: $product = 1 [*] @array; Hmm. Not all operators *have* an identity. You'd have to write, in that case; @array[0] [ƒ] @[EMAI

Re: reduce metaoperator on an empty list

2005-06-06 Thread Sam Vilain
Damian Conway wrote: What you want is: $product = ([*] @values err 0); Or: $factorial = ([*] 1..$n err 1); The "err" operator bind only to the point on the instruction it is attached to, ie it's not a shortcut for eval(), right? I'm just seeing some edge cases here for custom defined o

Re: New generational GC Scheme

2005-06-08 Thread Sam Vilain
Alexandre Buisse wrote: So we add a level of indirection: objects consist of a header and the actual data. Headers are allocated once and for all at object creation and do not move. [...] The big disadvantage of this approach is that we use one or two words (if objects need to know where their he

Re: reduce metaoperator on an empty list

2005-06-07 Thread Sam Vilain
Luke Palmer wrote: < and > still don't make sense as reduce operators. Observe the table: # of args | Return (type) 0 | -Inf 1 | Num (the argument) 2 | bool ... | bool Let's look at the type of one of the many `reduce' vari

Re: reduce metaoperator on an empty list

2005-06-09 Thread Sam Vilain
TSa (Thomas Sandlaß) wrote: I'm not sure but Perl6 could do better or at least trickier ;) Let's assume that < > <= >= when chained return an accumulated boolean and the least or greatest value where the condition was true. E.g. 0 < 2 < 3 returns 0 but true 1 < 2 < 1 returns 1 but false

AUTLOAD and $_

2005-06-19 Thread Sam Vilain
From S10; In any case, there is no longer any magical $AUTOLOAD variable. The name being declared or defined can be found in $_ instead. The name does not include the package name. You can always get your own package name with $?PACKAGENAME. So, what is the prototype of AUTOLOAD? It is

Re: AUTLOAD and $_

2005-06-20 Thread Sam Vilain
Juerd wrote: I think there exists an even simpler way to avoid any mess involved. Instead of letting AUTOLOAD receive and pass on arguments, and instead of letting AUTOLOAD call the loaded sub, why not have AUTOLOAD do its thing, and then have *perl* call the sub? sub AUTOLOAD ($w) { return o

Re: AUTLOAD and $_

2005-06-20 Thread Sam Vilain
chromatic wrote: Who says AUTOLOAD will always either call a loaded sub or fail? Maybe it should be passed a continuation too, then? Then it could choose exactly what to do with it. Sam.

AUTOLOAD, this time distinct from AUTOSUB etc (and spelt correctly)

2005-06-20 Thread Sam Vilain
OK, that last discussion was productive, but I think we all (including myself) overlooked the fact that the AUTOLOAD and AUTOSUB methods are implied to have different calling conventions; There is still an AUTOLOAD hook that behaves as in Perl 5. The (AUTO*) routines are expected to return a

Re: AUTOLOAD, this time distinct from AUTOSUB etc (and spelt correctly)

2005-06-20 Thread Sam Vilain
Rod Adams wrote: I never liked the idea of out-of-band arguments. Either something is passed, is available due to being in a broader scope, or can be gleamed from introspection. ok. First of all, I agree with the basic sentiment. However, to play devil's advocate and re-interpret what you ju

Magic mutators and my $var is Proxy( ... );

2005-06-26 Thread Sam Vilain
To me it is a trivial case that you want to provide a fake attribute which for all intents and purposes behaves exactly like there was a real attribute there, backing against another attribute. A Date object is a classic example of this; you want to provide 0-based and 1-based attributes, which y

Re: takers wanted - a perl job

2005-06-26 Thread Sam Vilain
Joshua Juran wrote: scalar number (possibly complex) real rational integer Integer BigInt Ratio Float Complex Quaternion String ... Trying to fit every problem int

Re: Magic mutators and my $var is Proxy( ... );

2005-06-26 Thread Sam Vilain
Sam Vilain wrote: To me it is a trivial case that you want to provide a fake attribute which for all intents and purposes behaves exactly like there was a real attribute there, backing against another attribute. A Date object is a classic example of this; you want to provide 0-based and 1-based

Re: AUTLOAD and $_

2005-06-26 Thread Sam Vilain
Piers Cawley wrote: For myself, I'd like to see AUTOLOAD with a signature along the lines of: sub AUTOLOAD (Symbol $sym, ArgumentCollection $args, Continuation $cc) returns (Code | Pair) { ... } This presupposes a deal of support infrastructure, but also provides flexibility. F

Re: SMD is for weenies

2005-06-30 Thread Sam Vilain
Yuval Kogman wrote: As I understand it SMD is now not much more than a mechanism to place a constraint on the MMD, saying that there can only be one method or subroutine with the same short name. Why is this the default? Otherwise you lose this quite useful warning if the signatures didn't matc

Re: DBI v2 - The Plan and How You Can Help

2005-07-03 Thread Sam Vilain
Hey Tim. > I've kept an eye on Perl 6 and Parrot developments but I'm no expert in > either. What I'd like *you* to do is make proposals (ideally fairly > detailed proposals, but vague ideas are okay) for what a Perl 6 DBI API > should look like. > Keep in mind that the role of the DBI is to prov

Re: DBI v2 - The Plan and How You Can Help

2005-07-04 Thread Sam Vilain
Richard Nuttall wrote: - support for automatically pulling database DSN information from a ~/.dbi (or similar) file. This is constantly re-invented poorly. Let's just do a connect by logical application name and let the SysAdmins sort out which DB that connects to, in a standard wa

Re: DBI v2 - The Plan and How You Can Help

2005-07-04 Thread Sam Vilain
Darren Duncan wrote: 3. Redefine prepare() and execute() such that the first is expressly for activities that can be done apart from a database (and hence can also be done for a connection handle that is closed at the time) while all activities that require database interaction are deferred to

Re: DBI v2 - The Plan and How You Can Help

2005-07-04 Thread Sam Vilain
Darren Duncan wrote: Okay, considering that using the same name prepare() like this may confuse some people, here is a refined solution that uses 3 methods instead; please disregard any contrary statements that I previously made: I think I'm beginning to like it. Allow me to suggest one or tw

Re: Time::Local

2005-07-05 Thread Sam Vilain
Darren Duncan wrote: Actually, there was a big oversight in my last message. It does not handle approximate or relative dates, such as when you don't know the details. FWIW, this is handled by DateTime::Incomplete, and also will be natively supported by Date::Gregorian. You're describing wit

Re: Time::Local

2005-07-05 Thread Sam Vilain
Craig DeForest wrote: Using the TAI epoch of 1958-01-01 00:00:00 has several advantages: - TAI is recognized by international standards-setting bodies (BIPM). - Perl6 will then shake out the 31-bit time rollover a full 12 years before I like this in principle, however I wonder of the

  1   2   >