Re: Bag / Set ideas - making them substitutable for Arrays makes them more useful

2010-11-16 Thread Darren Duncan
Jon Lang wrote: Darren Duncan wrote: This said, I specifically think that a simple pair of curly braces is the best way to mark a Set. {1,2,3} # a Set of those 3 elements ... and this is also how it is done in maths I believe (and in Muldis D). In fact, I strongly support this assuming

Re: Bag / Set ideas - making them substitutable for Arrays makes them more useful

2010-11-13 Thread Brandon S Allbery KF8NH
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/7/10 23:19 , Jon Lang wrote: 1 -- 2 -- 3 Would be a Bag containing three elements: 1, 2, and 3. Personally, I wouldn't put a high priority on this; for my purposes, Bag(1, 2, 3) works just fine. Hm. Bag as [! 1, 2, 3 !] and

Re: Bag / Set ideas - making them substitutable for Arrays makes them more useful

2010-11-13 Thread Jon Lang
Brandon S Allbery KF8NH wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/7/10 23:19 , Jon Lang wrote:     1 -- 2 -- 3 Would be a Bag containing three elements: 1, 2, and 3. Personally, I wouldn't put a high priority on this; for my purposes,    Bag(1, 2, 3) works just fine.

Re: Bag / Set ideas - making them substitutable for Arrays makes them more useful

2010-11-13 Thread Carl Mäsak
Jonathan Lang (): As well, my first impression upon seeing [! ... !] was to think you're negating everything inside?  That said, I could get behind doubled brackets:    [[1, 2, 3]] # same as Bag(1, 2, 3)    {{1, 2, 3}} # same as Set(1, 2, 3) AFAIK, this would cause no conflicts with

Re: Bag / Set ideas - making them substitutable for Arrays makes them more useful

2010-11-13 Thread Jon Lang
Carl Mäsak wrote: Jonathan Lang (): That saves a singlr character over Bag( ... ) and Set( ... ), respectively (or three characters, if you find decent unicode bracket choices).  It still wouldn't be a big enough deal to me to bother with it. +1. Let's leave it at that. That said, I do

Re: Bag / Set ideas - making them substitutable for Arrays makes them more useful

2010-11-13 Thread Darren Duncan
Jon Lang wrote: That saves a singlr character over Bag( ... ) and Set( ... ), respectively (or three characters, if you find decent unicode bracket choices). It still wouldn't be a big enough deal to me to bother with it. As well, my first impression upon seeing [! ... !] was to think you're

Re: Bag / Set ideas - making them substitutable for Arrays makes them more useful

2010-11-13 Thread The Sidhekin
On Sun, Nov 14, 2010 at 12:12 AM, Jon Lang datawea...@gmail.com wrote: Carl Mäsak wrote: Jonathan Lang (): That saves a singlr character over Bag( ... ) and Set( ... ), respectively (or three characters, if you find decent unicode bracket choices). It still wouldn't be a big enough deal

Re: Bag / Set ideas - making them substitutable for Arrays makes them more useful

2010-11-13 Thread Jon Lang
Darren Duncan wrote: Jon Lang wrote: That saves a singlr character over Bag( ... ) and Set( ... ), respectively (or three characters, if you find decent unicode bracket choices).  It still wouldn't be a big enough deal to me to bother with it. As well, my first impression upon seeing [!

Re: Bag / Set ideas - making them substitutable for Arrays makes them more useful

2010-11-09 Thread TSa (Thomas Sandlaß)
On Tuesday, 9. November 2010 01:45:52 Mason Kramer wrote: I have to disagree here. Arrays and Hashes may be about storage (I don't think they are, though, since you can change the (storage) implemenation of an Array or Hash via its metaclass and it can still remain an Array or Hash). What I

Re: Bag / Set ideas - making them substitutable for Arrays makes them more useful

2010-11-09 Thread Moritz Lenz
On 11/09/2010 09:26 PM, TSa (Thomas Sandlaß) wrote: But doesn't my $x = (1,2,3); my $y = map {$^x * $^x}, $x; result in $y containing the list (1,4,9)? Not at all. The $ sigil implies a scalar, so what you get is roughly my $y = (1, 2, 3).item * (1, 2, 3).item; so $y ends up

Re: Bag / Set ideas - making them substitutable for Arrays makes them more useful

2010-11-08 Thread Solomon Foster
On Sun, Nov 7, 2010 at 11:19 PM, Jon Lang datawea...@gmail.com wrote: Mason Kramer wrote: I'd like to anticipate one objection to this - the existence of the 'hyper' operator/keyword.  The hyper operator says, I am taking responsibility for this particular code block and promising that it

Re: Bag / Set ideas - making them substitutable for Arrays makes them more useful

2010-11-08 Thread Jon Lang
Solomon Foster wrote: Well, hyperoperators work fine on Hashes, they operate on the values, paired up by key if needed.  (That is, %hash++ doesn't care about the keys, %hash1 + %hash2 sums based on keys.)  I would assume that Bag should work in the exact same way.  Dunno how Set should work

Re: Bag / Set ideas - making them substitutable for Arrays makes them more useful

2010-11-08 Thread Mason Kramer
I'm honored that my letter generated so much activity, and thank you all for your thoughtful responses. I'd like to address a few points. On Monday, 8. November 2010 17:20:43 Jon Lang wrote: Solomon Foster wrote: Well, hyperoperators work fine on Hashes, they operate on the values, paired

Re: Bag / Set ideas - making them substitutable for Arrays makes them more useful

2010-11-08 Thread Jon Lang
This is going to be a rambling answer, as I have a number of questions but no firm conclusions. Please bear with me. Mason Kramer wrote: Having Bags flatten in list context is pretty crucial to their being as easy and terse to use as arrays, because flattening is fundamental to how Arrays are

Bag / Set ideas - making them substitutable for Arrays makes them more useful

2010-11-07 Thread Mason Kramer
I just implemented Bag to the point where it passes the spectests. (https://github.com/masonk/rakudo/commit/2668178c6ba90863538ea74cfdd287684a20c520) However, in doing so, I discovered that I'm not really sure what Bags are for, anymore. The more I think about Bags and Sets, the more my

Re: Bag / Set ideas - making them substitutable for Arrays makes them more useful

2010-11-07 Thread Darren Duncan
Mason Kramer wrote: snip I want to propose one major change to the Bag spec: When a Bag is used as an Iterable, you get an Iterator that has each key in proportion to the number of times it appears in the Bag. snip You present some interesting thoughts here. But I don't have enough time to

Re: Bag / Set ideas - making them substitutable for Arrays makes them more useful

2010-11-07 Thread Jon Lang
Mason Kramer wrote: I'd like to anticipate one objection to this - the existence of the 'hyper' operator/keyword.  The hyper operator says, I am taking responsibility for this particular code block and promising that it can execute out of order and concurrently.  Creating a Bag instead of

Re: Bag / Set ideas - making them substitutable for Arrays makes them more useful

2010-11-07 Thread Moritz Lenz
On 11/08/2010 01:51 AM, Darren Duncan wrote: Mason Kramer wrote: snip I want to propose one major change to the Bag spec: When a Bag is used as an Iterable, you get an Iterator that has each key in proportion to the number of times it appears in the Bag. snip You present some