Re: The ,= operator

2020-12-07 Thread Ralph Mellor
> > @fib[1, 5, 10..15, 20] > (1 8 (89 144 233 377 610 987) 10946) > ^ > > Why??? As Joe noted in his last email: > remember, back in perl-land the default behavior is to flatten, > in raku ... by default [raku is] oriented toward building up > complex structures like

Re: The ,= operator

2020-12-07 Thread Aureliano Guedes
I didn't understood > my @fib = 1,1, * + * … *; [...] > @fib[1] 1 > @fib[5] 8 > @fib[1..5] (1 2 3 5 8) *> @fib[1, 5, 10..15, 20](1 8 (89 144 233 377 610 987) 10946)* * ^* Why??? On Mon, Dec 7, 2020 at 2:27 AM William Michels via perl6-users <

Re: The ,= operator

2020-12-06 Thread William Michels via perl6-users
On Sun, Nov 29, 2020 at 6:38 PM Ralph Mellor wrote: > > Zen slicing as a possible way of 'de-containerizing' : > > https://docs.raku.org/language/subscripts#index-entry-Zen_slices > > A zen-slice only affects the single reference it's applied to. > > And it is a no op when applied to anything

Re: The ,= operator

2020-12-06 Thread Joseph Brenner
ToddAndMargo via perl6-users wrote: > I am a little late to this conversation, but `,=` > looks a lot like `push` to me. Yes that was my first impression, if you read ahead a bit in the discussion you'll see it explained. In summary: the = shortcuts all work in a precisely parallel way, so @r

Re: The ,= operator

2020-12-05 Thread ToddAndMargo via perl6-users
Hi All, I am a little late to this conversation, but `,=` looks a lot like `push` to me. Am I missing something? -T

Re: The ,= operator

2020-11-30 Thread Joseph Brenner
William Michels wrote: > Joe, what would you expect the code below to produce? > %h<> ,= c => 3; > @a[] ,= 'd'; Well *I* expect it to error out, but that's my p5 brain talking. The Raku approach is if you ask for nothing it gives you everything, so an empty index like that essentially

Re: The ,= operator

2020-11-29 Thread Ralph Mellor
> Ralph Mellor wrote: > >> > @r = @r , 'd'; > >> > >> There isn't anything very useful in this behavior though, is there? > > Just to be clear, I wasn't saying I didn't think circular references > should be forbidden, I just specifically meant that you weren't likely > to want the ",=" operator

Re: The ,= operator

2020-11-29 Thread Ralph Mellor
> Zen slicing as a possible way of 'de-containerizing' : > https://docs.raku.org/language/subscripts#index-entry-Zen_slices A zen-slice only affects the single reference it's applied to. And it is a no op when applied to anything other than a `Scalar`. So it'll have no effect when applied

Re: The ,= operator

2020-11-29 Thread William Michels via perl6-users
On Sun, Nov 29, 2020 at 9:16 AM Joseph Brenner wrote: > > William Michels wrote: > >> > "Perhaps more importantly, what improvement do you propose?" > > > > Apologies for top-posting, but what immediately comes to my mind upon > > encountering the creation of a self-referential

Re: The ,= operator

2020-11-29 Thread Joseph Brenner
William Michels wrote: >> > "Perhaps more importantly, what improvement do you propose?" > > Apologies for top-posting, but what immediately comes to my mind upon > encountering the creation of a self-referential (circular/infinite) > object is proverbially 'going-down-a-level' and trying again.

Re: The ,= operator

2020-11-29 Thread Joseph Brenner
Joseph Brenner wrote: > Just to be clear, I wasn't saying I didn't think circular references should be forbidden, Sorry about the double-negative. It could use another "not" to triple it.

Re: The ,= operator

2020-11-29 Thread Joseph Brenner
Ralph Mellor wrote: >> > @r = @r , 'd'; >> >> Okay, that makes sense. So the circular reference I thought I >> was seeing is really there, and it's working as designed. >> >> There isn't anything very useful in this behavior though, is there? > > Yes. > > Here are some relevant results from a

Re: The ,= operator

2020-11-29 Thread Parrot Raiser
P.S. My apologies for top-posting in the quoted text, and my apologies to William for the duplication. On 11/29/20, Parrot Raiser <1parr...@gmail.com> wrote: > Having a consistent ("regular", in the linguistic sense), structure > for something like the op= form is obviously very desirable. It's

Re: The ,= operator

2020-11-28 Thread William Michels via perl6-users
> > "Perhaps more importantly, what improvement do you propose?" Apologies for top-posting, but what immediately comes to my mind upon encountering the creation of a self-referential (circular/infinite) object is proverbially 'going-down-a-level' and trying again. So I tried 1. 'decontainerizing'

Re: The ,= operator

2020-11-28 Thread Ralph Mellor
> > @r = @r , 'd'; > > Okay, that makes sense. So the circular reference I thought I > was seeing is really there, and it's working as designed. > > There isn't anything very useful in this behavior though, is there? Yes. Here are some relevant results from a search for "self referential" in

Re: The ,= operator

2020-11-27 Thread Joseph Brenner
About the documentation in general... > > that particular pair-input syntax is my least favorite. > > Flipping around the order of key and value when the value is a numeric...? > > > > And it isn't needed to demo the operator, any pair input syntax works. > > I might argue that examples should

Re: The ,= operator

2020-11-27 Thread Joseph Brenner
First off, much thanks to Ralph Mellor for his detailed explanations. Ralph Mellor wrote: > @r ,= 'd'; > > The above expands to: > > @r = @r , 'd'; Okay, that makes sense. So the circular reference I thought I was seeing is really there, and it's working as designed. There isn't anything

Re: The ,= operator

2020-11-27 Thread Ralph Mellor
@r ,= 'd'; The above expands to: @r = @r , 'd'; That in turn passes a list of two values to the LHS receiver. That receiver is `@r`, an array, and what arrays do with `=` is to empty themselves and then assign the list of elements on the RHS of the `=` into corresponding `Scalar`s stored in

Re: The ,= operator

2020-11-27 Thread William Michels via perl6-users
Hi Joe, I can reproduce your results on Rakudo_2020.10, but I'm afraid I don't have much more to say about the ",=" operator since I'm unfamiliar with it. Do the "docs" page(s) make more sense changing the phrase "class-dependent" behavior to "hash-dependent" behavior? Best, Bill. On Thu, Nov

Re: Match operator: error with any() junction and user-defined $_ topic variable

2019-10-14 Thread ToddAndMargo via perl6-users
On 10/12/19 3:08 AM, William Michels via perl6-users wrote: Inline: On Fri, Oct 11, 2019 at 8:33 PM ToddAndMargo via perl6-users wrote: On 10/11/19 8:09 PM, William Michels via perl6-users wrote: Hi Todd, Per the REPL, $x looks to be a List: mbook:~ homedir$ perl6 To exit type 'exit' or

Re: Match operator: error with any() junction and user-defined $_ topic variable

2019-10-12 Thread William Michels via perl6-users
Inline: On Fri, Oct 11, 2019 at 8:33 PM ToddAndMargo via perl6-users wrote: > > On 10/11/19 8:09 PM, William Michels via perl6-users wrote: > > Hi Todd, Per the REPL, $x looks to be a List: > > > > mbook:~ homedir$ perl6 > > To exit type 'exit' or '^D' > >> > >> my $x = (44,66) > > (44 66) > >>

Re: Match operator: error with any() junction and user-defined $_ topic variable

2019-10-11 Thread ToddAndMargo via perl6-users
On 10/11/19 8:09 PM, William Michels via perl6-users wrote: Hi Todd, Per the REPL, $x looks to be a List: mbook:~ homedir$ perl6 To exit type 'exit' or '^D' my $x = (44,66) (44 66) say $x.WHAT (List) say $x.^name List my $y = < 55 77 > (55 77) say $y.WHAT (List) say $y.^name List

Re: Match operator: error with any() junction and user-defined $_ topic variable

2019-10-11 Thread William Michels via perl6-users
Hi Todd, Per the REPL, $x looks to be a List: mbook:~ homedir$ perl6 To exit type 'exit' or '^D' > > my $x = (44,66) (44 66) > say $x.WHAT (List) > say $x.^name List > > my $y = < 55 77 > (55 77) > say $y.WHAT (List) > say $y.^name List > > say $*VM moar (2019.07.1) HTH, Bill. On Fri, Oct 11,

Re: Match operator: error with any() junction and user-defined $_ topic variable

2019-10-11 Thread ToddAndMargo via perl6-users
On 10/11/19 2:46 AM, William Michels via perl6-users wrote: Below works: mbook:~ homedir$ perl6 -e 'my $x = (44, 66); say $x; say $x.any < 43' (44 66) any(False, False) # mbook:~ homedir$ perl6 -e 'my $x = (44, 66); say $x; say $x.any < 50' (44 66) any(True, False) # mbook:~ homedir$ perl6 -e

Re: Match operator: error with any() junction and user-defined $_ topic variable

2019-10-11 Thread William Michels via perl6-users
Below works: mbook:~ homedir$ perl6 -e 'my $x = (44, 66); say $x; say $x.any < 43' (44 66) any(False, False) # mbook:~ homedir$ perl6 -e 'my $x = (44, 66); say $x; say $x.any < 50' (44 66) any(True, False) # mbook:~ homedir$ perl6 -e 'my $x=0; my $any=2|4|8; $x==$any ?? put "x exists, value= $x"

Re: Match operator: error with any() junction and user-defined $_ topic variable

2019-10-10 Thread Todd Chester via perl6-users
On 10/8/19 10:53 AM, Brad Gilbert wrote: Most operations with Junctions produce Junctions.     > 1 + any(2, 3)     any(3, 4) $ p6 'say 4 + any(44,66);' any(48, 70) Sweet! But what would you ever use it for? Would this be the intended use: add a number to all values in an array? $ p6

Re: Match operator: error with any() junction and user-defined $_ topic variable

2019-10-08 Thread William Michels via perl6-users
Thank you very much Brad!! Let's redirect all conversation on this particular issue here: https://github.com/rakudo/rakudo/issues/3221 Best Regards, Bill. On Tue, Oct 8, 2019 at 10:53 AM Brad Gilbert wrote: > > Most operations with Junctions produce Junctions. > > > 1 + any(2, 3) >

Re: Match operator: error with any() junction and user-defined $_ topic variable

2019-10-08 Thread Brad Gilbert
Most operations with Junctions produce Junctions. > 1 + any(2, 3) any(3, 4) > any(1, 2) + 3 any(4, 5) > any() ~~ /./ any(「a」, 「c」) In the case of the following line, `$/` gets assigned a junction of the results. > if any(@genus) ~~ m/Hama/ { put "Matches at least

Re: The = operator and context

2012-04-03 Thread Moritz Lenz
Am 03.04.2012 17:10, schrieb Daniel Carrera: (1..10).WHAT # = Range() @foo = 1..10; @foo.WHAT # = Array() When you assign a range to @foo, the result is an array. Something similar happens, for example, if you assign a scalar to @foo... The context of the assignment causes Perl 6 to

Re: The = operator and context

2012-04-03 Thread Daniel Carrera
On 3 April 2012 17:24, Moritz Lenz mor...@faui2k3.org wrote: You can, very nearly. You just need to write my @vec is Vector; because you really want to change the type of the container, not just of the contents (my Vector @vec would be an array containing Vector objects). Another option

Re: The = operator and context

2012-04-03 Thread Moritz Lenz
On 04/03/2012 08:24 PM, Daniel Carrera wrote: On 3 April 2012 17:24, Moritz Lenz mor...@faui2k3.org wrote: You can, very nearly. You just need to write my @vec is Vector; because you really want to change the type of the container, not just of the contents (my Vector @vec would be an array

Re: The = operator and context

2012-04-03 Thread Daniel Carrera
On 3 April 2012 20:38, Moritz Lenz mor...@faui2k3.org wrote: which version of Rakudo are you using? (I've tried on the last development version from git) Rakudo Star 2012.02 % perl6 --version This is perl6 version 2012.02 built on parrot 4.1.0 revision 0 Hmm...  So you'd have to mess with

Re: series operator issues

2010-07-31 Thread David Green
On 2010-07-23, at 4:25 am, Moritz Lenz wrote: I'm still not convinced. [that there should be a special index variable] Yes, it would be convient, but I've yet to see a non-contrived example where it's actually necessary, and which can't be implemented trivially with other Perl 6 tools. I

Re: series operator issues

2010-07-23 Thread Mark J. Reed
If we expected Perl6 to be able to recognize these series and continue them based on nothing but the first few elements, that would be a dwimmy OEIS. (And an OEIS module that did that by consulting the real OEIS would be cool, outside of core.) But that's not what this is about. This is just

Re: series operator issues

2010-07-23 Thread Moritz Lenz
Am 23.07.2010 00:29, schrieb Damian Conway: However, those *are* clunky and nigh unreadable, so I certainly wouldn't object to having the index of the next generated element readily available as an explicit variable in a series' generator block. That would make all manner of evil both easier

Re: series operator issues

2010-07-22 Thread Moritz Lenz
Hi, Am 22.07.2010 17:18, schrieb Jon Lang: When I last reviewed the writeup for the series operators, I noticed two issues: First, why is the RHS argument a list? You only ever use the first element of it; so why don't you just reference a single value? The idea is that you can continue

Re: series operator issues

2010-07-22 Thread Aaron Sherman
On Thu, Jul 22, 2010 at 11:41 AM, Moritz Lenz mor...@faui2k3.org wrote: The difficulty you're running into is that you're trying to use the wrong tool for the job. Just don't use the series operator when it's not easy to use. Perl 6 has other mechanism too, which are better suited for these

Re: series operator issues

2010-07-22 Thread Jon Lang
On Thu, Jul 22, 2010 at 9:25 AM, Aaron Sherman a...@ajs.com wrote: On Thu, Jul 22, 2010 at 11:41 AM, Moritz Lenz mor...@faui2k3.org wrote: The difficulty you're running into is that you're trying to use the wrong tool for the job. Just don't use the series operator when it's not easy to use.

Re: series operator issues

2010-07-22 Thread Aaron Sherman
On Thu, Jul 22, 2010 at 1:13 PM, Jon Lang datawea...@gmail.com wrote: I also think it's doable without a special tool: 0, { state $i = 1; $^a + $i++ } ... * Kludgey; but possibly doable. Well, it's kind of what state is there for. But what I'd really like to see would be for the

Re: series operator issues

2010-07-22 Thread Jon Lang
On Thu, Jul 22, 2010 at 11:35 AM, Aaron Sherman a...@ajs.com wrote: On Thu, Jul 22, 2010 at 1:13 PM, Jon Lang datawea...@gmail.com wrote:  Yes, it would be a special tool; but it would be much more in keeping with the keep simple things easy philosophy that Perl 6 tends to promote:    0, {

Re: series operator issues

2010-07-22 Thread Aaron Sherman
On Thu, Jul 22, 2010 at 4:52 PM, Jon Lang datawea...@gmail.com wrote: I do have to admit that that's awfully clean-looking, but the implementation would force a closure in a series to behave differently from a closure anywhere else. How so? Unlike some of you, I haven't managed to

Re: series operator issues

2010-07-22 Thread Damian Conway
On 23 July 2010 01:41, Moritz Lenz mor...@faui2k3.org wrote: Use the right tool for the right job:    square numbers: 0, 1, 4, 9, 16, 25, 36, etc. (1..10).map(* ** 2) Or even just: (1..10) »**» 2 Note that you can also get most of the effects you want by using @_ in the series'

Re: series operator issues

2010-07-22 Thread Brandon S Allbery KF8NH
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 7/22/10 11:18 , Jon Lang wrote: Second, I'm trying to think of a simple and intuitive way to write up a series expression for: triangle numbers: 0, 1, 3, 6, 10, 15, 21, etc. square numbers: 0, 1, 4, 9, 16, 25, 36, etc. factorials:

Re: decision operator

2009-03-25 Thread Larry Wall
On Wed, Mar 25, 2009 at 12:25:59AM +0100, Moritz Lenz wrote: : Ruud H.G. van Tol wrote: : I wonder if there is place for a decision operator. : : This looks like a perfect place for a (possibly user defined) operator : with an attribute, something like : : 1 ~~ 0 :dop(7) To me it looks more

Re: decision operator

2009-03-24 Thread Moritz Lenz
Ruud H.G. van Tol wrote: I wonder if there is place for a decision operator. (search terms: FPGA, evolvable hardware, Xilinx, PLB, LUT, NESW) dop:| 0 1 2 3 4 5 6 7 8 9 A B C D E F + 0 0 | 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 1 | 0 0 0 0 1 1 1 1 0 0 0 0 1

Re: decision operator

2009-03-24 Thread Moritz Lenz
Moritz Lenz wrote: Ruud H.G. van Tol wrote: I wonder if there is place for a decision operator. (search terms: FPGA, evolvable hardware, Xilinx, PLB, LUT, NESW) dop:| 0 1 2 3 4 5 6 7 8 9 A B C D E F + 0 0 | 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 1 | 0 0 0

Re: cross operator and empty list

2008-04-16 Thread TSa
HaloO, Larry Wall wrote: Then [X]() also is ()? How about (0,1) X ([]) === (0,1)? No, that's (0,[]), (1,[1]). [] *doesn't* flatten in list context. I guess you meant (0,[]), (1,[]). And you didn't answer what [X]() returns. Following your arguments this would be undef. I am genuinely

RE: cross operator and empty list

2008-04-14 Thread Miller, Hugh
-Original Message- From: Mark A. Biggar [mailto:[EMAIL PROTECTED] Sent: Sunday, April 13, 2008 11:22 PM To: Miller, Hugh Cc: Moritz Lenz; p6l Subject: Re: cross operator and empty list Miller, Hugh wrote: From: Moritz Lenz [mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] wrote

Re: cross operator and empty list

2008-04-14 Thread TSa
HaloO, Xavier Noria wrote: {0, 1} X {{}} = {(0, {}), (1, {})} which, you see, is different from {0, 1}. They have different elements. The fact that there's a clear mapping that sort of identifies them has nothing to do with set equality. But X is cooperating with , in Perl 6: (0,1) X

Re: cross operator and empty list

2008-04-14 Thread Larry Wall
On Mon, Apr 14, 2008 at 12:05:15PM +0200, TSa wrote: But X is cooperating with , in Perl 6: (0,1) X (()) === ((0,()),(1,())) === (0,1) That is, X strips the outer list and comma concatenates the inner empty list away. No, the inner () is also in list context, and () in list context always

Re: cross operator and empty list

2008-04-14 Thread TSa
HaloO, Larry Wall wrote: No, the inner () is also in list context, and () in list context always just disappears. And 0,1 X () is going to be (). Perl 6's infix:X is defined over lists, not sets. If you want to overload X for set types, you may. Then [X]() also is ()? How about (0,1) X

Re: cross operator and empty list

2008-04-14 Thread TSa
HaloO, I wrote: Then [X]() also is ()? How about (0,1) X ([]) === (0,1)? The original question was sort of about how to write a list that has .elems == 1 but no content. Other ideas are: [[]] and @@() with the latter not very likely because it implies any multidimensional array somehow having

Re: cross operator and empty list

2008-04-14 Thread Larry Wall
On Mon, Apr 14, 2008 at 06:28:06PM +0200, TSa wrote: HaloO, Larry Wall wrote: No, the inner () is also in list context, and () in list context always just disappears. And 0,1 X () is going to be (). Perl 6's infix:X is defined over lists, not sets. If you want to overload X for set

Re: cross operator and empty list

2008-04-14 Thread Doug McNutt
At 09:58 -0700 4/14/08, Larry Wall wrote: By the way, you don't need to put parens around the arguments to X. It takes a list on either side. We made it tall so that it would stand out visually anyway: $a,$b,$c X $x,$y,$z How long before some engineer or 3D graphic artist gets really

Re: cross operator and empty list

2008-04-14 Thread Larry Wall
On Mon, Apr 14, 2008 at 11:47:04AM -0600, Doug McNutt wrote: : At 09:58 -0700 4/14/08, Larry Wall wrote: : By the way, you don't need to put parens around the arguments to X. It takes a list on either side. We made it tall so that it would stand out visually anyway: : : $a,$b,$c X $x,$y,$z

Re: cross operator and empty list

2008-04-14 Thread John M. Dlugosz
Doug McNutt douglist-at-macnauchtan.com |Perl 6| wrote: At 09:58 -0700 4/14/08, Larry Wall wrote: By the way, you don't need to put parens around the arguments to X. It takes a list on either side. We made it tall so that it would stand out visually anyway: $a,$b,$c X $x,$y,$z

RE: cross operator and empty list

2008-04-13 Thread Miller, Hugh
-Original Message- From: Moritz Lenz [mailto:[EMAIL PROTECTED] Sent: Saturday, April 12, 2008 10:37 AM To: [EMAIL PROTECTED] Cc: p6l Subject: Re: cross operator and empty list [EMAIL PROTECTED] wrote: Technically the Cartesian cross operator doesn't have an identity value. It has

Re: cross operator and empty list

2008-04-13 Thread Mark A. Biggar
Miller, Hugh wrote: From: Moritz Lenz [mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Technically the Cartesian cross operator doesn't have an identity value. It has. The set which contains only the emty set, or in perl terms ([]); Or am I missing something? Should be a (any) 1 point set

Re: cross operator and empty list

2008-04-12 Thread Moritz Lenz
[EMAIL PROTECTED] wrote: Technically the Cartesian cross operator doesn't have an identity value. It has. The set which contains only the emty set, or in perl terms ([]); Or am I missing something? Cheers, Moritz -- Moritz Lenz http://moritz.faui2k3.org/ | http://perl-6.de/ signature.asc

Re: cross operator and empty list

2008-04-07 Thread TSa
HaloO, Larry Wall wrote: (@a X @b X @c).elems == @a.elems * @b.elems * @c.elems Sorry, I was aiming at defining a neutral element of the X operator. In cartesian products of sets this is achieved by having a set that contains as sole member the empty tuple. So how would that be written?

Re: cross operator and empty list

2008-04-07 Thread Adriano Ferreira
On Mon, Apr 7, 2008 at 4:50 AM, TSa [EMAIL PROTECTED] wrote: HaloO, Larry Wall wrote: (@a X @b X @c).elems == @a.elems * @b.elems * @c.elems Sorry, I was aiming at defining a neutral element of the X operator. A neutral element for the cross operator seems weird if that is to be

Re: cross operator and empty list

2008-04-07 Thread Darren Duncan
Adriano, I think perhaps what Tsa is trying to get at is the identity value for the X operator, and I believe I know what it is. In the relational model of data, both the version of the model where tuples have unordered named attributes/elements (which I prefer), and the version where tuples

Re: cross operator and empty list

2008-04-07 Thread mark . a . biggar
Technically the Cartesian cross operator doesn't have an identity value. There is no set X such that A x X = A. Now any singleton set gives a result that is naturally isomorphic to the original set, I.e, there is a obvious bijection between the two sets, but they are not equal sets. -- Mark

Re: cross operator and empty list

2008-04-07 Thread Darren Duncan
[EMAIL PROTECTED] wrote: Technically the Cartesian cross operator doesn't have an identity value. There is no set X such that A x X = A. Now any singleton set gives a result that is naturally isomorphic to the original set, I.e, there is a obvious bijection between the two sets, but they are

Re: cross operator and empty list

2008-04-04 Thread mark . a . biggar
Cartesain product with the empty set is empty. A x B is the set of all pairs (a,b) where a is in A and b is in B. If either is empty then there are no such pairs and the result is also empty. -- Mark Biggar [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] -- Original message

Re: cross operator and empty list

2008-04-04 Thread Larry Wall
On Fri, Apr 04, 2008 at 06:51:20PM +0200, TSa wrote: HaloO, why is (1,2,3) X () defined to be the empty list and not (1,2,3) as is the case with the cartesian product of sets which X basically is with preserved order. (@a X @b X @c).elems == @a.elems * @b.elems * @c.elems Larry

Re: cross operator and empty list

2008-04-04 Thread Mark J. Reed
Cartesian product of anything with the empty set is empty. Which is why SQL has outer joins. On 4/4/08, TSa [EMAIL PROTECTED] wrote: HaloO, why is (1,2,3) X () defined to be the empty list and not (1,2,3) as is the case with the cartesian product of sets which X basically is with preserved

Re: xx operator

2006-09-28 Thread Juerd
Fagyal Csongor skribis 2006-09-28 15:11 (+0200): say $string xx $repeat; List context. my $add = $string xx $repeat; Item context, for a list repetition operator. Doesn't really make sense, and I think a warning or error message would be more appropriate. I

Re: xx operator

2006-09-28 Thread Fagyal Csongor
A. Pagaltzis wrote: I have the following code: class MyStupidString { method repeatit(Str $string, Int $repeat) { say $string xx $repeat; my $add = $string xx $repeat; say $add; } }; my $obj = MyStupidString.new;

Re: available operator characters

2005-05-07 Thread Matt Creenan
On Sat, 07 May 2005 01:47:08 -0400, Matt Creenan [EMAIL PROTECTED] wrote: So here's some random ideas that probably make no sense ($ can be optional.. don't know) *snip* That brings me to another idea. Is $_ as an array used? @_? This relates back to the discussion on topics. Could be use @_

Re: available operator characters

2005-05-07 Thread Juerd
Mark A. Biggar skribis 2005-05-06 22:12 (-0700): Actually if we define |...| at all, I'd prefer it mean abs(), its usual mathmatical meaning. No. We can't just use circumfix |...| with arbitrary expressions in it, because | is taken as an infix operator. It has to be quoteish (like (this is

Re: available operator characters

2005-05-07 Thread Juerd
Matt Creenan skribis 2005-05-07 1:47 (-0400): I thought about $blockname = { ... }, but = is obviously taken, as is == $blockname =: for 1..5 { $blockname := for 1..5 { } $blockname; } =: $blockname; } $blockname; $blockname for 1..5 { $blockname

Re: available operator characters

2005-05-07 Thread Juerd
Matt Creenan skribis 2005-05-07 4:14 (-0400): That brings me to another idea. Is $_ as an array used? @_? The default signature of subs is ([EMAIL PROTECTED]). Juerd -- http://convolution.nl/maak_juerd_blij.html http://convolution.nl/make_juerd_happy.html

Re: available operator characters

2005-05-07 Thread Luke Palmer
On 5/6/05, Larry Wall [EMAIL PROTECTED] wrote: The question is whether to treat the left arg the same way we treat attribute defaults, with one free closure call. We could say that { rand 10 } x 100 { rand 10 } xx 100 should just automatically call the closure on the left

Re: available operator characters

2005-05-07 Thread Larry Wall
On Sat, May 07, 2005 at 02:23:15PM +0200, Juerd wrote: : Matt Creenan skribis 2005-05-07 1:47 (-0400): : I thought about $blockname = { ... }, but = is obviously taken, as is == : $blockname =: for 1..5 { : $blockname := for 1..5 { : } $blockname; : } =: $blockname; : }

Re: available operator characters

2005-05-06 Thread Juerd
Luke Palmer skribis 2005-05-06 10:43 (-0600): Why the %!@ would you ignore that!? :-) I hate my brain. Now I wonder if Bool.does(Hash). Does it? :) Juerd -- http://convolution.nl/maak_juerd_blij.html http://convolution.nl/make_juerd_happy.html http://convolution.nl/gajigu_juerd_n.html

Re: available operator characters

2005-05-06 Thread Juerd
Luke Palmer skribis 2005-05-06 10:43 (-0600): Thanks! Here's an annotated bit for each ?. Only the triple-questionmarks were meant as questions. I should have picked a better meta-operator for AVAILABLE?. But apparently, even though I didn't mean to ask so many questions, there still are

Re: available operator characters

2005-05-06 Thread Luke Palmer
On 5/6/05, Juerd [EMAIL PROTECTED] wrote: Luke Palmer skribis 2005-05-06 10:43 (-0600): !not none() ??? Nope. In order to create those, you just need to say none(). There is no operator form. Do we have postfix ! for factorials, or is it available? No, it's

Re: available operator characters

2005-05-06 Thread Juerd
Luke Palmer skribis 2005-05-06 11:04 (-0600): Because we're marking all of our singular nouns with $, and you have to admit, the $ sigil in perl code is much more common than @ and %. What good is a noun marker if you mark some of your verbs with it too? But verbing doesn't weird language at

Re: available operator characters

2005-05-06 Thread Patrick R. Michaud
On Fri, May 06, 2005 at 06:24:00PM +0200, Juerd wrote: To try and make it easier to pick (ASCII) operators, a simple table of what's given away and what's available. Please let me know if there are any mistakes. If anyone knows how to fill in the ??? parts, be my guest! [...] \w+

Re: available operator characters

2005-05-06 Thread Juerd
Patrick R. Michaud skribis 2005-05-06 12:20 (-0500): Ummm, what about Cnot and Ctrue ? I'm sticking to non-words here, as I mentally parse not and true as single-arg subs, single-arg subs as unary operators, etcetera. I can't help it, but I have absolutely no idea how to determine the

Re: available operator characters

2005-05-06 Thread Rob Kinyon
I'm sticking to non-words here, as I mentally parse not and true as single-arg subs, single-arg subs as unary operators, etcetera. I can't help it, but I have absolutely no idea how to determine the difference. Is it prefix:not or just not? I have no idea. I do know that it's infix:x, not x.

Re: available operator characters

2005-05-06 Thread Larry Wall
On Fri, May 06, 2005 at 01:31:43PM -0400, Rob Kinyon wrote: : I'm sticking to non-words here, as I mentally parse not and true as : single-arg subs, single-arg subs as unary operators, etcetera. I can't : help it, but I have absolutely no idea how to determine the difference. : Is it

Re: available operator characters

2005-05-06 Thread Larry Wall
On Fri, May 06, 2005 at 06:49:44PM +0200, Juerd wrote: : Luke Palmer skribis 2005-05-06 10:43 (-0600): : Why the %!@ would you ignore that!? :-) : : I hate my brain. Now I wonder if Bool.does(Hash). Does it? :) Any Object does Hash, and treats any argumentless method as a potential hash key.

Re: available operator characters

2005-05-06 Thread Larry Wall
On Fri, May 06, 2005 at 11:25:31AM -0700, Larry Wall wrote: : Any Object does Hash, and treats any argumentless method as a potential : hash key. I should also point out that the main reason for this is to allow easier translation of Perl 5 idioms to Perl 6 without having to guess whether $foo

Re: available operator characters

2005-05-06 Thread Juerd
Juerd skribis 2005-05-06 18:24 (+0200): |AVAILABLE any() We can use this for labels: |foo| for ... { while ... { ...; next foo if ...; } } It'll confuse the heck out of Ruby coders, but I do like this syntax. It makes labels

Re: available operator characters

2005-05-06 Thread Larry Wall
On Fri, May 06, 2005 at 10:43:07AM -0600, Luke Palmer wrote: : :: namespace ternary : : That's class sigil in term position. Separating namespaces never : have preceding whitespace, so they're always part of some larger term. Really more like a package sigil, which can be

Re: available operator characters

2005-05-06 Thread Larry Wall
On Fri, May 06, 2005 at 06:24:00PM +0200, Juerd wrote: : {} href|closure hash (deref+)subscript (no ws) : {}? (clash) AVAILABLE (ws) s/AVAILABLE/statement block/ Actually, I'd try to find a way to combine all the paired ws-dependent entries onto the same

Re: available operator characters

2005-05-06 Thread Juerd
Larry Wall skribis 2005-05-06 18:22 (-0700): (But then you need to put postfix first in the heading.) The heading uses junctions, and junctions are unordered ;) Juerd -- http://convolution.nl/maak_juerd_blij.html http://convolution.nl/make_juerd_happy.html

Re: available operator characters

2005-05-06 Thread Mark A. Biggar
Juerd wrote: Juerd skribis 2005-05-06 18:24 (+0200): |AVAILABLE any() We can use this for labels: |foo| for ... { while ... { ...; next foo if ...; } } It'll confuse the heck out of Ruby coders, but I do like this syntax. It makes

Re: available operator characters

2005-05-06 Thread Matt Creenan
On Sat, 07 May 2005 01:12:02 -0400, Mark A. Biggar [EMAIL PROTECTED] wrote: Actually if we define |...| at all, I'd prefer it mean abs(), its usual mathmatical meaning. I agree. I think || is just confusing. I thought about $blockname = { ... }, but = is obviously taken, as is == So here's

Re: Hyper operator corner case?

2005-04-18 Thread =?UTF-8?B?VGhvbWFzIFNhbmRsYcOf?=
Roger Hale wrote: One set of cases that doesn't seem to have come up in discussion: (1, 3, 2) - (83, 84, 81, 80, 85) Should this give (-82, -81, -79, -80, -85) From an arithmetic point of view it should be exactly that. The implementation might need to morph the code though, see below. as

Re: Hyper operator corner case?

2005-04-17 Thread Roger Hale
Thomas Sandla wrote: John Williams wrote: Good point. Another one is: how does the meta_operator determine the identity value for user-defined operators? Does it have to? The definition of the identity value---BTW, I like the term neutral value better because identity also is a relation between

Re: Hyper operator corner case?

2005-04-15 Thread Thomas Sandla
John Williams wrote: Good point. Another one is: how does the meta_operator determine the identity value for user-defined operators? Does it have to? The definition of the identity value---BTW, I like the term neutral value better because identity also is a relation between two values---is that

Re: Hyper operator corner case?

2005-04-14 Thread John Williams
I found where Damain explains the rule as basically replicate dimensions, extend lengths, using an identity value when extending the length. http://www.mail-archive.com/perl6-language@perl.org/msg08304.html On Wed, 13 Apr 2005, Thomas Sandlaß wrote: Brent 'Dax' Royal-Gordon wrote: IIRC, it's

Re: Hyper operator corner case?

2005-04-14 Thread Larry Wall
On Thu, Apr 14, 2005 at 11:08:21AM -0600, John Williams wrote: : Good point. Another one is: how does the meta_operator determine the : identity value for user-defined operators? : : (1,2,3,4,5) my_infix_op (3,2,4) : : Maybe we should say that the excess length is simply copied unchanged. :

Re: splat operator and context

2005-03-09 Thread Juerd
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); my

Re: splat operator and context

2005-03-09 Thread Aldo Calpini
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

Re: splat operator and context

2005-03-09 Thread Luke Palmer
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 for

Re: splat operator and context

2005-03-09 Thread Larry Wall
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.

  1   2   3   4   >