develooper Front page | perl.perl6.users | Postings from September 2018

Re: Rat

Thread Previous | Thread Next
From:
Vadim Belman
Date:
September 17, 2018 02:34
Subject:
Re: Rat
Message ID:
243C5598-D032-4FB2-88F4-097D592576E0@lflat.org
You're messing up a type and a method to convert into that type. For example, 

dd "1.2".Rat

will output you a rational whereas 

dd "1.2"

will output a string.

Again, search for Rat on docs gives you a line just under the Class section. 

> 16 вер. 2018 р. о 22:29 ToddAndMargo <ToddAndMargo@zoho.com> написав(ла):
> 
> Hi All,
> 
> What in the world are they trying to say here?
> 
> https://docs.perl6.org/routine/Rat
>    (Numeric) method Rat
> 
>    method Rat(Numeric:D: Real $epsilon = 1.0e-6 --> Rat:D)
> 
>    If this Numeric is equivalent to a Real, return a Rat which
>    is within $epsilon of that Real's value. Fail
>    with X::Numeric::Real otherwise.
> 
> And is this why I can not find a type "Rat"?  Because
> it is a method?
> 
> Then why does
>    $ p6 'my Real $x; $x = 3.1415; dd $x;'
>    Rat $x = 3.1415
> say it is a type "Rat"?
> 
> 
> Yours in confusion,
> -T
> 

Best regards,
Vadim Belman

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About