Re: nil mystery

2018-04-30 Thread ToddAndMargo
On 04/30/2018 05:20 PM, Andrew Kirkpatrick wrote: I couldn't reproduce this by assigning Nil to a variable Well as it transpires, when I tested the {$x} version, I forgot to press "save". Also, a one liner operated differently than a program. And to top things off, when reading "this" data

Re: nil mystery

2018-04-30 Thread Andrew Kirkpatrick
The original error you quoted was about use of Nil. I couldn't reproduce this by assigning Nil to a variable, turns out that's because such an assignment is specified to set the variable to the default value of the type of the variable. my $x = Nil gives (Any), my Str $y = Nil gives (Str), and

Re: .sub confusion

2018-04-30 Thread Bruce Gray
> On Apr 30, 2018, at 8:04 AM, ToddAndMargo wrote: > > Hi All, > > I am confused. > > With this sub: > >sub odd( $Num ) { return $Num % 2; } > > > Why does this work: > > if odd $LineNum > { $PartsStr ~= ''; } # Green >else { $PartsStr

Re: odd and even

2018-04-30 Thread Theo van den Heuvel
Hi Todd, different people have different ways of learning things. Diving into the documentation isn't ideal for all of us. I find the book by Laurent Rosenfeld, "Think Perl 6", O'Reilly, extremely helpful in addition to the docs. My problem is that I am working with many and quite different

Re: odd and even

2018-04-30 Thread Elizabeth Mattijsen
> On 30 Apr 2018, at 15:12, ToddAndMargo wrote: > > On 04/30/2018 05:44 AM, Elizabeth Mattijsen wrote: >>> On 30 Apr 2018, at 12:43, ToddAndMargo wrote: >>> >>> Am 30.04.2018 um 08:47 schrieb ToddAndMargo: > Hi All, > > I know

Re: odd and even

2018-04-30 Thread Elizabeth Mattijsen
> On 30 Apr 2018, at 15:12, ToddAndMargo wrote: > > On 04/30/2018 05:44 AM, Elizabeth Mattijsen wrote: >>> On 30 Apr 2018, at 12:43, ToddAndMargo wrote: >>> >>> Am 30.04.2018 um 08:47 schrieb ToddAndMargo: > Hi All, > > I know

Re: .sub confusion

2018-04-30 Thread Elizabeth Mattijsen
> On 30 Apr 2018, at 15:04, ToddAndMargo wrote: > > Hi All, > > I am confused. > > With this sub: > >sub odd( $Num ) { return $Num % 2; } > > > Why does this work: > > if odd $LineNum > { $PartsStr ~= ''; } # Green >else { $PartsStr ~=

Re: odd and even

2018-04-30 Thread ToddAndMargo
On 04/30/2018 05:44 AM, Elizabeth Mattijsen wrote: On 30 Apr 2018, at 12:43, ToddAndMargo wrote: Am 30.04.2018 um 08:47 schrieb ToddAndMargo: Hi All, I know it would only take me 25 seconds to write one, but do we have an odd and even function build in? Many

.sub confusion

2018-04-30 Thread ToddAndMargo
Hi All, I am confused. With this sub: sub odd( $Num ) { return $Num % 2; } Why does this work: if odd $LineNum { $PartsStr ~= ''; } # Green else { $PartsStr ~= ''; } # Purple And this one throw an error: if $LineNum.odd { $PartsStr ~=

Re: odd and even

2018-04-30 Thread Elizabeth Mattijsen
> On 30 Apr 2018, at 12:43, ToddAndMargo wrote: > > >> Am 30.04.2018 um 08:47 schrieb ToddAndMargo: >>> Hi All, >>> >>> I know it would only take me 25 seconds to write one, >>> but do we have an odd and even function build in? >>> >>> >>> Many thanks, >>> -T >>> >>>

Re: nil mystery

2018-04-30 Thread ToddAndMargo
On Sun, Apr 29, 2018 at 10:20:48PM -0700, ToddAndMargo wrote: On 04/29/2018 10:12 PM, ToddAndMargo wrote: On 04/29/2018 09:32 PM, Andrew Kirkpatrick wrote: There is not enough context to answer or even reproduce the problem - how are the variables declared and what values do they have just

Re: odd and even

2018-04-30 Thread ToddAndMargo
Am 30.04.2018 um 08:47 schrieb ToddAndMargo: Hi All, I know it would only take me 25 seconds to write one, but do we have an odd and even function build in? Many thanks, -T $ perl6 -e 'my $x=3; say $x.odd;' No such method 'odd' for invocant of type 'Int'. Did you mean 'ord'?   in block at

Re: odd and even

2018-04-30 Thread Martin Barth
Are you aware of the %% operator? $var %% 2 checks wether it is dividable by 2. Am 30.04.2018 um 08:47 schrieb ToddAndMargo: Hi All, I know it would only take me 25 seconds to write one, but do we have an odd and even function build in? Many thanks, -T $ perl6 -e 'my $x=3; say $x.odd;' No

Re: inheritance and default attributes

2018-04-30 Thread Theo van den Heuvel
Thanks Elibeth and JJMerelo, stupid mistake. I use stack overflow all the time. Thanks, Theo https://stackoverflow.com/questions/50031400/inheriting-private-attributes-in-perl-6 And this is why I always encourage people to post questions to StackOverflow. Or also to StackOverflow :-) JJ

Re: inheritance and default attributes

2018-04-30 Thread JJ Merelo
El lun., 30 abr. 2018 a las 11:08, Elizabeth Mattijsen () escribió: > > On 30 Apr 2018, at 10:55, Theo van den Heuvel > wrote: > > > > Hi all, > > > > trying to make sense of the following excerpt from the documentation on > object construction: > > > >

Re: odd and even

2018-04-30 Thread ToddAndMargo
El lun., 30 abr. 2018 a las 9:46, ToddAndMargo (>) escribió: On 04/30/2018 12:04 AM, JJ Merelo wrote: > Check out the docs.perl6.org page... And no, we > don't. Love the

Re: inheritance and default attributes

2018-04-30 Thread Elizabeth Mattijsen
> On 30 Apr 2018, at 10:55, Theo van den Heuvel wrote: > > Hi all, > > trying to make sense of the following excerpt from the documentation on > object construction: > > Due to the default behavior of BUILDALL and BUILD submethods, named arguments > to the constructor

inheritance and default attributes

2018-04-30 Thread Theo van den Heuvel
Hi all, trying to make sense of the following excerpt from the documentation on object construction: Due to the default behavior of BUILDALL and BUILD submethods, named arguments to the constructor new derived from Mu can correspond directly to public attributes of any of the classes in

Re: odd and even

2018-04-30 Thread JJ Merelo
When they are not, please raise an issue. We'll try to solve it ASAP. El lun., 30 abr. 2018 a las 9:46, ToddAndMargo () escribió: > On 04/30/2018 12:04 AM, JJ Merelo wrote: > > Check out the docs.perl6.org page... And no, we > > don't. > > Love the

Re: odd and even

2018-04-30 Thread ToddAndMargo
On 04/30/2018 12:04 AM, JJ Merelo wrote: Check out the docs.perl6.org page... And no, we don't. Love the docs. Not always really helpful though.

Re: odd and even

2018-04-30 Thread JJ Merelo
Check out the docs.perl6.org page... And no, we don't. El lun., 30 abr. 2018 a las 8:48, ToddAndMargo () escribió: > Hi All, > > I know it would only take me 25 seconds to write one, > but do we have an odd and even function build in? > > > Many thanks, > -T > > $ perl6 -e

odd and even

2018-04-30 Thread ToddAndMargo
Hi All, I know it would only take me 25 seconds to write one, but do we have an odd and even function build in? Many thanks, -T $ perl6 -e 'my $x=3; say $x.odd;' No such method 'odd' for invocant of type 'Int'. Did you mean 'ord'? in block at -e line 1 $ perl6 -e 'my $x=3; say $x.even;'