Re: some questions about S02(type)
I don't think an array of hashes and a hash of arrays could perfectly represent a Table type. There are several important facts of a relational model:unordered columns and tupples, various constraints on columns. E.g. how can we represent multi-unique constraints as an array of hashes? On 4/4/09, Timothy S. Nelson wrote: > On Sat, 4 Apr 2009, Xiao Yafeng wrote: > 3. Could I define primary key for a bag variable? >>> >>> All items in a Bag are "primary keys", but there's no data additional >>> data associated with it. >> >> I mean whether I can see Set as a table and Bag as a table with a >> unique constraint? like: >>subset test of Bag(test_name Str, test_ID Int, primary >> key(test_ID)) > > I don't think you can really do something like that. Perl 6 as > specified leaves many things up to libraries. Implementing a Table type > will > no doubt be one of those things. I would like to have a Table type that > will > work well with the Tree/Plex type that I am working on. > > In the meantime, a table would need to be represented as an array of > hashes, or a hash of arrays. > > HTH, > > > - > | Name: Tim Nelson | Because the Creator is,| > | E-mail: wayl...@wayland.id.au| I am | > - > > BEGIN GEEK CODE BLOCK > Version 3.12 > GCS d+++ s+: a- C++$ U+++$ P+++$ L+++ E- W+ N+ w--- V- > PE(+) Y+>++ PGP->+++ R(+) !tv b++ DI D G+ e++> h! y- > -END GEEK CODE BLOCK- > >
Fwd: Multi-Dimensional arrays
-- Forwarded message -- From: Peter Schwenn Date: Apr 4, 2009 3:14 PM Subject: Re: Multi-Dimensional arrays To: Carl Mäsak I've had inconsistent/incorrect results, once having created an array of array of arrays, both while addressing elements in it as @A[l][m][n]=x and as @a[l][...@y ; as severe, for example, as modifying @A[16]'s contents in addressing @A[14] . Perhaps I should wait. Or perhaps what you're saying includes a prohibition against using any references to @A which have two or more "[..]" . The reason I thought I could use [][] and [][][] is because I had no problem using @B[]{} where I had an array of hashes. Another thing I could do is to learn how to search RT to see better what works and what doesn't. On 4/4/09, Carl Mäsak wrote: > Peter (>): > > > Am I right that multi-dimensional arrays do not yet work fully in Rakudo? > > > Yes, you are. > > That is to say, you can't do this yet: > > my @a[4;2]; # Valid indices are 0..3 ; 0..1 > > There's nothing stopping you from creating an array of arrays, though. > > > // Carl >
Fwd: Multi-Dimensional arrays
-- Forwarded message -- From: Carl Mäsak Date: Sun, Apr 5, 2009 at 9:30 AM Subject: Re: Multi-Dimensional arrays To: Peter Schwenn Peter (>): > I've had inconsistent/incorrect results, once having created an array > of array of arrays, both while addressing elements in it as > @A[l][m][n]=x and as @a[l][...@y ; as severe, for example, as > modifying @A[16]'s contents in addressing @A[14] . Aye; that may or may not be a bug. I've previously fallen into this trap: $ perl6 -e 'my @a = [[0 xx 3] xx 3] xx 3; @a[1][2][0] = 7; say @a.perl' [[[7, 0, 0], [7, 0, 0], [7, 0, 0]], [[7, 0, 0], [7, 0, 0], [7, 0, 0]], [[7, 0, 0], [7, 0, 0], [7, 0, 0]]] But that (if I understand correctly) is how C is specced to behave. It doesn't create clones of the Array, it gives you several references to the same one. What does work, and what I settled on in Druid (which pretty much depends on multidimensional arrays working properly), is using map: $ perl6 -e 'my @a = map {[map {[map { 0 }, ^3]}, ^3]}, ^3; @a[1][2][0] = 7; say @a.perl' [[[0, 0, 0], [0, 0, 0], [0, 0, 0]], [[0, 0, 0], [0, 0, 0], [7, 0, 0]], [[0, 0, 0], [0, 0, 0], [0, 0, 0]]] > Perhaps I should wait. Or perhaps what you're saying includes a > prohibition against using any references to @A which have two or more > "[..]" . The reason I thought I could use [][] and [][][] is because > I had no problem using @B[]{} where I had an array of hashes. I'm not 100% sure, but I would bet that your problems stem from a distinction such as the one above. > Another thing I could do is to learn how to search RT to see better > what works and what doesn't. Yes, please do that! Not for this particular reason, but simply because we need more people with knowledge about the tickets in RT. Lately, they have grown unnecessarily, simply because we have too few eyes finding closeables and duplicates. // Carl
Re: Dallas.p6m
On Mar 19, 2009, at 2:35 PM, Andy Lester wrote: I love love LOVE starting to get people together to talk about Perl 6. It's a crucial step in letting people know that Perl 6 is real. However, starting social groups that say they are specifically about Perl 6 makes me uncomfortable. I think it would be better to call it Dallas.pm and just talk about Perl 6 in the meeting announcements. The key is that we don't want people to think they must choose one or the other. Technologically, Perl 5 and Perl 6 are very different, but culturally, they're very similar. Keeping Perl 5 and Perl 6 groups together also means that we will increase cross-pollination of Perl 6 onto the Perl 5 people. At Madison.pm, I give a 5-minute Perl 6 update each month. It's easy to collect material because Rakudo and Parrot each release monthly, so I can always just rehash the release announcements. I've found that the Perl 5 users are quite interested (and occasionally amazed). Chris
Re: some questions about S02(type)
On Sat, 4 Apr 2009, Darren Duncan wrote: Speaking of libraries, I already implemented a table type ... it's called Set::Relation/::V2 and its on CPAN right now ... for Perl 5 ... I still have to port it to Perl 6, unless someone else wants to do that, but I designed it so that would be easy to do. The port could stand for some additional Perl 6 savvyness too. Can it be attached to an SQL backend? :) - | Name: Tim Nelson | Because the Creator is,| | E-mail: wayl...@wayland.id.au| I am | - BEGIN GEEK CODE BLOCK Version 3.12 GCS d+++ s+: a- C++$ U+++$ P+++$ L+++ E- W+ N+ w--- V- PE(+) Y+>++ PGP->+++ R(+) !tv b++ DI D G+ e++> h! y- -END GEEK CODE BLOCK-