Re: Metamethods: WHERE

2020-02-12 Thread Brad Gilbert
If you want to find out if two variables are bound to the same data, there is an operator for that my $a = 3; my $b = 3; say $a =:= $b; # False my $c := $b; say $b =:= $c; # True On Wed, Feb 12, 2020 at 7:27 AM Aureliano Guedes wrote: > Thank you. > > So, I'd like to find

Re: Metamethods: WHERE

2020-02-12 Thread Aureliano Guedes
Thanks for the tip! This might be useful to data analysis tools. On Wed, Feb 12, 2020 at 11:01 AM Brad Gilbert wrote: > If you want to find out if two variables are bound to the same data, there > is an operator for that > > my $a = 3; > my $b = 3; > say $a =:= $b; # False > >

Re: Metamethods: WHERE

2020-02-12 Thread Patrick R. Michaud
On Wed, Feb 12, 2020 at 10:27:20AM -0300, Aureliano Guedes wrote: > So, I'd like to find a way to test if two variables are bound or not, > especially concerning their memory address. > > If the address is not fixed for a lifetime, I must be able to test it in > just one cycle. > > $a.WHERE ==

Re: Metamethods: WHERE

2020-02-12 Thread Aureliano Guedes
Thank you. It really helps. Then I go further to understand and I find interesting. The same applies to int 3. > 3.WHERE 94821123453912 As expected, is different from str 3 > "3".WHERE 139904951827592 But the same to $a. > my $a = 3; 3 I suppose that the constant 3 is created only when called.

Re: variable as subroutine?

2020-02-12 Thread Andy Bach
> So, the problem is you didn't call the same var you had declared. my $foo = * **2; > Then you call foo(2).say > Missing the $ D'oh! Thanks. > About the my @a = * **2; > Your suggestion works @a[0](2) > or @a[0].(2) > But I would appreciate an explanation about why `$a[0](0)` didn't work.

Metamethods: WHERE

2020-02-12 Thread Aureliano Guedes
What "WHERE" should return? I was trying to find a method to return the memory address of some data. Then I find the WHERE statement. https://rosettacode.org/wiki/Address_of_a_variable#Perl_6 https://docs.perl6.org/language/mop#WHERE Then I tested it. I created $a, $b and $c, where $c is binded

Re: Metamethods: WHERE

2020-02-12 Thread Elizabeth Mattijsen
> On 12 Feb 2020, at 13:44, Aureliano Guedes wrote: > > What "WHERE" should return? > > I was trying to find a method to return the memory address of some data. > Then I find the WHERE statement. > https://rosettacode.org/wiki/Address_of_a_variable#Perl_6 >

Re: Metamethods: WHERE

2020-02-12 Thread Aureliano Guedes
Thank you. So, I'd like to find a way to test if two variables are bound or not, especially concerning their memory address. If the address is not fixed for a lifetime, I must be able to test it in just one cycle. > $a.WHERE == $b.WHERE # I expected FALSE True To a bound variable, I expect

Re: variable as subroutine?

2020-02-12 Thread Aureliano Guedes
On Wed, Feb 12, 2020 at 1:09 PM Andy Bach wrote: > > So, the problem is you didn't call the same var you had declared. > > my $foo = * **2; > > > Then you call > > foo(2).say > > > Missing the $ > D'oh! Thanks. > > > About the > > my @a = * **2; > > > Your suggestion works > > @a[0](2) > > > or

Re: variable as subroutine?

2020-02-12 Thread William Michels via perl6-users
On Wed, Feb 12, 2020 at 8:12 AM Aureliano Guedes wrote: > > > On Wed, Feb 12, 2020 at 1:09 PM Andy Bach > wrote: > >> > So, the problem is you didn't call the same var you had declared. >> >> my $foo = * **2; >> >> > Then you call >> >> foo(2).say >> >> > Missing the $ >> D'oh! Thanks. >> >> >

Re: variable as subroutine?

2020-02-12 Thread Andy Bach
> watch about a minute of this Damian Conway video--where he shows the new Raku > (Perl6) sigil table: https://youtu.be/Nq2HkAYbG5o?t=568 Watch the whole thing - D.C. is one of the most entertaining instructors I've ever had the pleasure to list to[1], plus he's smarter than a sitting on a

Re: variable as subroutine?

2020-02-12 Thread Aureliano Guedes
Thank for sharing, I'll watch right now On Wed, Feb 12, 2020 at 4:28 PM William Michels wrote: > > > On Wed, Feb 12, 2020 at 8:12 AM Aureliano Guedes < > guedes.aureli...@gmail.com> wrote: > >> >> >> On Wed, Feb 12, 2020 at 1:09 PM Andy Bach >> wrote: >> >>> > So, the problem is you didn't