Re: definition confusion of + and +^

2020-01-20 Thread ToddAndMargo via perl6-users
On 2020-01-20 08:32, Peter Pentchev wrote: On Sun, Jan 19, 2020 at 08:25:15PM -0800, ToddAndMargo via perl6-users wrote: One last question on htis. What does multi sub prefix:<+^>(Any --> Int:D) Mean. Prefix means before. +^(Any) get me a participation trophy, so I do not understand. :'(

Re: definition confusion of + and +^

2020-01-20 Thread Peter Pentchev
On Sun, Jan 19, 2020 at 08:25:15PM -0800, ToddAndMargo via perl6-users wrote: > One last question on htis. What does > > multi sub prefix:<+^>(Any --> Int:D) > > Mean. Prefix means before. +^(Any) get > me a participation trophy, so I do not > understand. > > > :'( > > INQUIRING MINDS WANT

Re: definition confusion of + and +^

2020-01-19 Thread ToddAndMargo via perl6-users
One last question on htis. What does multi sub prefix:<+^>(Any --> Int:D) Mean. Prefix means before. +^(Any) get me a participation trophy, so I do not understand. :'( INQUIRING MINDS WANT TO KNOW! (That is a joke referencing a tabloid commercial.) -T

Re: definition confusion of + and +^

2020-01-19 Thread ToddAndMargo via perl6-users
On 2020-01-19 08:52, Marcel Timmerman wrote: On 1/19/20 2:47 AM, ToddAndMargo via perl6-users wrote: Hi All, Thank you all for the wonderful help on this. What I am still confused about is how to read these silly definition lines:   multi sub infix:<+>($a, $b --> Numeric:D)   multi

Re: definition confusion of + and +^

2020-01-19 Thread Marcel Timmerman
On 1/19/20 2:47 AM, ToddAndMargo via perl6-users wrote: Hi All, Thank you all for the wonderful help on this. What I am still confused about is how to read these silly definition lines:   multi sub infix:<+>($a, $b --> Numeric:D)   multi sub infix:<+^>($a, $b --> Int:D) How exactly

Re: definition confusion of + and +^

2020-01-18 Thread ToddAndMargo via perl6-users
On 2020-01-18 15:59, Elizabeth Mattijsen wrote: s/he/it/ The idea that no gentleman ever swears is all wrong. He can swear and still be a gentleman, if he does it in a nice and benevolent and affectionate way. --Mark Twain - Private and Public Morals speech, 1906 :-)

Re: definition confusion of + and +^

2020-01-18 Thread ToddAndMargo via perl6-users
Hi All, Thank you all for the wonderful help on this. What I am still confused about is how to read these silly definition lines: multi sub infix:<+>($a, $b --> Numeric:D) multi sub infix:<+^>($a, $b --> Int:D) How exactly does the above tell me to do this? $c = $a +  $b

Re: definition confusion of + and +^

2020-01-18 Thread ToddAndMargo via perl6-users
On 2020-01-18 15:59, Elizabeth Mattijsen wrote: infix: foo + bar prefix:+foo postfix: foo++ circumfix: [foo] postcircumfix: foo[bar] Hi Liz, You are still putting the cart before the horse. This is the step you jumped over: An "infix" is a term that ... You

Re: definition confusion of + and +^

2020-01-18 Thread Elizabeth Mattijsen
> On 19 Jan 2020, at 00:24, ToddAndMargo via perl6-users > wrote: > Wonderful so far. But then he DOES not describe what > "infix, prefix, postfix, circumfix, postcircumfix" > arfe/means before jumping into details. This is bad > form in technical writing. s/he/it/ > Again, wonderful so far.

Re: definition confusion of + and +^

2020-01-18 Thread ToddAndMargo via perl6-users
On 2020-01-18 13:16, Brad Gilbert wrote: Note that Int:D does NOT do any coercions. Int:D() does do coercions. Specifically Int:D() is short for Int:D(Any). Which means it coerces from Any to Int, and the result must be defined. Does the same apply to UInt:D and UInt:D()?

Re: definition confusion of + and +^

2020-01-18 Thread ToddAndMargo via perl6-users
On 2020-01-18 13:16, Curt Tilmes wrote: On Sat, Jan 18, 2020, 3:39 PM ToddAndMargo via perl6-users mailto:perl6-us...@perl.org>> wrote: 4)  infix:<+> means you can call it as a sub that      gives you back the wrong answer.          $c = +($a, $b)          $c = +^($a,

Re: definition confusion of + and +^

2020-01-18 Thread ToddAndMargo via perl6-users
On 2020-01-18 13:16, Brad Gilbert wrote: Most operators in Raku are subroutines.     1 + 2     infix:<+>( 1, 2 )     -1     prefix:<->( 1 ) My mistake was thinking `infix:<+>` meqan to put the `+` before the `)` Note that Int:D does NOT do any coercions. Int:D() does do coercions.

Re: definition confusion of + and +^

2020-01-18 Thread ToddAndMargo via perl6-users
On 2020-01-18 13:10, Veesh Goldman wrote: Hi Todd, I would suggest reading https://docs.raku.org/language/optut. This one starts out with: Operators are declared by using the sub keyword followed by prefix, infix, postfix, circumfix, or postcircumfix; then a colon and the operator

Re: definition confusion of + and +^

2020-01-18 Thread ToddAndMargo via perl6-users
On 2020-01-18 13:11, Marcel Timmerman wrote:     my $a=2; my $b=3; my $c = +($a, $b) Here is the mistake that + in front of a list means (...).elems (also used as a prefix, not infix), so there are 2 items in the list which is true. So '+(1,2,3)' returns 3 and '+(^10)' is 10 and

Re: definition confusion of + and +^

2020-01-18 Thread Brad Gilbert
Most operators in Raku are subroutines. 1 + 2 infix:<+>( 1, 2 ) -1 prefix:<->( 1 ) You can add your own operators by creating such a subroutine. sub postfix: ( UInt \n ) { [×] 2..n } say 5!; # 120 Because it is so easy to add operators. Operators only do one thing.

Re: definition confusion of + and +^

2020-01-18 Thread Curt Tilmes
On Sat, Jan 18, 2020, 3:39 PM ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote: > > 4) infix:<+> means you can call it as a sub that > gives you back the wrong answer. > > $c = +($a, $b) > $c = +^($a, $b) > You left off the infix:<> part of the sub's name.

Re: definition confusion of + and +^

2020-01-18 Thread Veesh Goldman
Hi Todd, I would suggest reading https://docs.raku.org/language/optut. For a slightly more thorough read https://docs.raku.org/language/functions#Defining_operators. On Sat, Jan 18, 2020 at 10:39 PM ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote: > Hi All, > > Okay, I clearly do not

definition confusion of + and +^

2020-01-18 Thread ToddAndMargo via perl6-users
Hi All, Okay, I clearly do not understand what is going on with these definitions, so please correct my assumptions! https://docs.raku.org/language/operators#infix_+ https://docs.raku.org/routine/+$CIRCUMFLEX_ACCENT Question: would some kind soul please tell me how: multi sub