Re: metamorphosis or alchemy?

2018-09-16 Thread ToddAndMargo
On 9/16/18 8:59 PM, Brandon Allbery wrote: Also, going by math calling the "real numbers" misses that math treats integers as a subset of real numbers; there is no hard distinction between them in math. Computers need hard distinctions here because integral, rational, and floating point

Re: metamorphosis or alchemy?

2018-09-16 Thread ToddAndMargo
On 9/16/18 9:10 PM, Brandon Allbery wrote: Sort of. A role is a "package" of components available to build classes from. This allows someone to write a sub or method that works for any kind of number by using the role instead of having to write the same thing over and over for every numeric

Re: metamorphosis or alchemy?

2018-09-16 Thread ToddAndMargo
On 9/16/18 9:02 PM, ToddAndMargo wrote: On 9/16/18 8:51 PM, Brandon Allbery wrote: You're assuming "Real" means "a float of some kind". It's not; it defines all the operations in common over non-Complex numbers (Int, Rat, Num, etc.). What you are looking for, Perl 6 calls Num.

Re: metamorphosis or alchemy?

2018-09-16 Thread Brandon Allbery
Sort of. A role is a "package" of components available to build classes from. This allows someone to write a sub or method that works for any kind of number by using the role instead of having to write the same thing over and over for every numeric class, or every class representing a non-complex

Re: metamorphosis or alchemy?

2018-09-16 Thread ToddAndMargo
On 9/16/18 8:51 PM, Brandon Allbery wrote: You're assuming "Real" means "a float of some kind". It's not; it defines all the operations in common over non-Complex numbers (Int, Rat, Num, etc.). What you are looking for, Perl 6 calls Num. https://docs.perl6.org/type.html: Real role

Re: metamorphosis or alchemy?

2018-09-16 Thread Brandon Allbery
You're assuming "Real" means "a float of some kind". It's not; it defines all the operations in common over non-Complex numbers (Int, Rat, Num, etc.). What you are looking for, Perl 6 calls Num. On Sun, Sep 16, 2018 at 8:53 PM ToddAndMargo wrote: > Hi All, > > I am confused, again: > > > $ p6

Re: metamorphosis or alchemy?

2018-09-16 Thread Vadim Belman
Actually what I meant was my Real $x = 3; $x = Nil; $x.WHO.say What you must read undoubtedly are this: https://docs.perl6.org/language/containers and this: https://opensource.com/article/18/8/containers-perl-6

Re: metamorphosis or alchemy?

2018-09-16 Thread ToddAndMargo
16 вер. 2018 р. о 22:11 Curt Tilmes > написав(ла): It isn't changing anything. You've still got a box ('container') that can only hold something 'Real'. You just happen to have a value in that box that is a 'Rat'. It is perfectly fine to put a Rat value in a Real box,

Re: metamorphosis or alchemy?

2018-09-16 Thread Vadim Belman
Actually, typing 'dd' in the searchbox on docs.perl6.org gives you a long list with dd in 'Reference' section of that list. > > https://docs.perl6.org/routine/dd > 404: Page Not Found > > Search does not work either. > Best regards, Vadim Belman

Re: metamorphosis or alchemy?

2018-09-16 Thread ToddAndMargo
On Sun, Sep 16, 2018 at 10:07 PM ToddAndMargo > wrote: On 09/16/2018 06:50 PM, Curt Tilmes wrote: > Note that an object that is a Rat also does Real (see > https://docs.perl6.org/type/Rat#Type_Graph) > > say Rat ~~ Real > > True

Re: metamorphosis or alchemy?

2018-09-16 Thread Vadim Belman
I would add on top of Curt's explanation. Try assigning Nil to $x and then ask for its type. You'll get your Real back! > 16 вер. 2018 р. о 22:11 Curt Tilmes написав(ла): > > It isn't changing anything. > > You've still got a box ('container') that can only hold something 'Real'. > > You

Re: metamorphosis or alchemy?

2018-09-16 Thread Curt Tilmes
It isn't changing anything. You've still got a box ('container') that can only hold something 'Real'. You just happen to have a value in that box that is a 'Rat'. It is perfectly fine to put a Rat value in a Real box, because a Rat is also a Real (does the 'Real' role). You can still stick

Re: metamorphosis or alchemy?

2018-09-16 Thread ToddAndMargo
On 09/16/2018 06:50 PM, Curt Tilmes wrote: Note that an object that is a Rat also does Real (see https://docs.perl6.org/type/Rat#Type_Graph) say Rat ~~ Real True Your're making a box that takes a Real, then putting a Rat (that also does Real) into that box. It then says "yes, you've got a

Re: metamorphosis or alchemy?

2018-09-16 Thread Curt Tilmes
Note that an object that is a Rat also does Real (see https://docs.perl6.org/type/Rat#Type_Graph) say Rat ~~ Real True Your're making a box that takes a Real, then putting a Rat (that also does Real) into that box. It then says "yes, you've got a Rat in there". On Sun, Sep 16, 2018 at 9:35

Re: metamorphosis or alchemy?

2018-09-16 Thread ToddAndMargo
On 09/16/2018 05:52 PM, ToddAndMargo wrote: Hi All, I am confused, again: $ p6 'my $x=3; dd $x' Int $x = 3 Makes sense $ p6 'my $x; dd $x' Any $x = Any Makes Sense $ p6 'my Real $x; dd $x' Real $x = Real makes sense $ p6 'my Real $x = 3; dd $x' Int $x = 3 What Integer ?  Did I or

metamorphosis or alchemy?

2018-09-16 Thread ToddAndMargo
Hi All, I am confused, again: $ p6 'my $x=3; dd $x' Int $x = 3 Makes sense $ p6 'my $x; dd $x' Any $x = Any Makes Sense $ p6 'my Real $x; dd $x' Real $x = Real makes sense $ p6 'my Real $x = 3; dd $x' Int $x = 3 What Integer ? Did I or did I not just tell it is was a "Real" ?