Re: how do I turn a real into and array of Integers?

2021-10-31 Thread ToddAndMargo via perl6-users
On 10/31/21 19:39, Sean McAfee wrote: On Sun, Oct 31, 2021 at 6:51 PM ToddAndMargo via perl6-users mailto:perl6-users@perl.org>> wrote: >> How do I get more digits out of sqrt? On 10/31/21 17:50, Kevin Pye wrote:  > You don't.  >  > sqrt is a function which acts on

Re: A nice touch

2021-10-31 Thread Ralph Mellor
On Mon, Nov 1, 2021 at 2:38 AM Ralph Mellor wrote: > > `R` reverses associativity, which is *another* way that `R` is a > nicely designed metaoperator, though this latter aspect is not > relevant to why it worked for the solution you came up with? Ah no. Of course it has to do the reversal or it

Re: A nice touch

2021-10-31 Thread Ralph Mellor
On Sun, Oct 31, 2021 at 6:10 PM Sean McAfee wrote: > > the main point of my message was about the R metaoperator and the > associativity of the operator it creates. OK. Fwiw this was something I didn't know, or had forgotten, and I find it delightful. The main point of *my* comment was that I

Re: how do I turn a real into and array of Integers?

2021-10-31 Thread Sean McAfee
On Sun, Oct 31, 2021 at 6:51 PM ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > >> How do I get more digits out of sqrt? > > On 10/31/21 17:50, Kevin Pye wrote: > > You don't. > > > > sqrt is a function which acts on 64-bit floating point numbers, and > there's no more meaningful

Re: how do I turn a real into and array of Integers?

2021-10-31 Thread ToddAndMargo via perl6-users
How do I get more digits out of sqrt? On 10/31/21 17:50, Kevin Pye wrote: > You don't. > > sqrt is a function which acts on 64-bit floating point numbers, and there's no more meaningful digits available. If you need more precision you're on your own. Dang! I was hoping ther was some

Re: how do I turn a real into and array of Integers?

2021-10-31 Thread Kevin Pye
You don't. sqrt is a function which acts on 64-bit floating point numbers, and there's no more meaningful digits available. If you need more precision you're on your own. On Mon, 1 Nov 2021, at 11:20, ToddAndMargo via perl6-users wrote: > On 10/31/21 16:42, ToddAndMargo via perl6-users wrote:

Re: how do I turn a real into and array of Integers?

2021-10-31 Thread ToddAndMargo via perl6-users
On 10/31/21 16:42, ToddAndMargo via perl6-users wrote: On 10/31/21 11:20, Sean McAfee wrote: On Sun, Oct 31, 2021 at 9:08 AM Andinus via perl6-users mailto:perl6-users@perl.org>> wrote:     put 2.sqrt.comb.grep(*.Int)>>.Int[^10].raku # 10 digits comb takes an argument that can save you

Re: how do I turn a real into and array of Integers?

2021-10-31 Thread ToddAndMargo via perl6-users
On 10/31/21 11:20, Sean McAfee wrote: On Sun, Oct 31, 2021 at 9:08 AM Andinus via perl6-users mailto:perl6-users@perl.org>> wrote:     put 2.sqrt.comb.grep(*.Int)>>.Int[^10].raku # 10 digits comb takes an argument that can save you a method call:     2.sqrt.comb.grep(*.Int)   ==>    

Re: how do I turn a real into and array of Integers?

2021-10-31 Thread Sean McAfee
On Sun, Oct 31, 2021 at 9:08 AM Andinus via perl6-users < perl6-users@perl.org> wrote: > put 2.sqrt.comb.grep(*.Int)>>.Int[^10].raku # 10 digits > comb takes an argument that can save you a method call: 2.sqrt.comb.grep(*.Int) ==> 2.sqrt.comb(/\d/)

Re: A nice touch

2021-10-31 Thread Sean McAfee
On Sat, Oct 30, 2021 at 9:21 PM Wes Peng wrote: > What's the "**" operator in perl? I most of the time use R for math, not > familiar with this operation. > It's exponentiation: https://docs.raku.org/language/operators#infix_** That wasn't a Raku expression I used it in, though, just my

Re: A nice touch

2021-10-31 Thread Sean McAfee
On Sat, Oct 30, 2021 at 9:03 PM Ralph Mellor wrote: > On Sat, Oct 30, 2021 at 8:38 PM Sean McAfee wrote: > > Anyway, pretty cool! > > I agree it's cool, at least in a golfing sense. > > But is your explanation right? > > The *range* operator (`..`), if the rhs is less than the left, > yields an

Re: how do I turn a real into and array of Integers?

2021-10-31 Thread Andinus via perl6-users
ToddAndMargo via perl6-users @ 2021-10-30 23:57 -07: > Without going into why (it is a secret), how do I turn > >> my $x = sqrt 2 > 1.4142135623730951 > > into an array of integers? > @y[0] = 1 > @y[1] = 4 > @y[2] = 1 > @y[3] = 4 > @y[4] = 2 > @y[5] = 1 put

Re: how do I turn a real into and array of Integers?

2021-10-31 Thread Bruce Gray
> On Oct 31, 2021, at 6:10 AM, ToddAndMargo via perl6-users > wrote: > > On 10/31/21 01:43, Shlomi Fish wrote: > >>> ("" ~ sqrt(2)).comb().grep(* ne ".").map(+*) >> (1 4 1 4 2 1 3 5 6 2 3 7 3 0 9 5 1) > > Cool! > > my Int @x = ("" ~ sqrt(2)).comb().grep(* ne ".").map(+*) > [1 4 1 4 2 1 3

Re: how do I turn a real into and array of Integers?

2021-10-31 Thread sisyphus
On Sun, Oct 31, 2021 at 10:10 PM ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > On 10/31/21 01:43, Shlomi Fish wrote: > > > > >> ("" ~ sqrt(2)).comb().grep(* ne ".").map(+*) > > (1 4 1 4 2 1 3 5 6 2 3 7 3 0 9 5 1) > > Cool! > > my Int @x = ("" ~ sqrt(2)).comb().grep(* ne

Re: how do I turn a real into and array of Integers?

2021-10-31 Thread ToddAndMargo via perl6-users
On 10/31/21 01:43, Shlomi Fish wrote: ("" ~ sqrt(2)).comb().grep(* ne ".").map(+*) (1 4 1 4 2 1 3 5 6 2 3 7 3 0 9 5 1) Cool! my Int @x = ("" ~ sqrt(2)).comb().grep(* ne ".").map(+*) [1 4 1 4 2 1 3 5 6 2 3 7 3 0 9 5 1] Is there a way to set how many digits I get?

Re: how do I turn a real into and array of Integers?

2021-10-31 Thread Shlomi Fish
Hi all! On Sun, 31 Oct 2021 15:14:07 +0800 Alice wrote: > Hello > > Try this one: > > use strict; > > use Data::Dumper; > > > my $x = sqrt 2; > > my @li= grep{/\d+/} split//,$x; > > > print Dumper \@li; > Or in raku: > ("" ~ sqrt(2)).comb().grep(* ne ".").map(+*) (1 4 1 4 2 1 3 5 6 2

Re: how do I turn a real into and array of Integers?

2021-10-31 Thread Alice
Hello Try this one: use strict; use Data::Dumper; my $x = sqrt 2; my @li= grep{/\d+/} split//,$x; print Dumper \@li; $ perl t1.pl $VAR1 = [ '1', '4', '1', '4', '2', '1', '3', '5', '6',

how do I turn a real into and array of Integers?

2021-10-31 Thread ToddAndMargo via perl6-users
Hi All, Without going into why (it is a secret), how do I turn > my $x = sqrt 2 1.4142135623730951 into an array of integers? @y[0] = 1 @y[1] = 4 @y[2] = 1 @y[3] = 4 @y[4] = 2 @y[5] = 1 etc. Many thanks, -T

Re: ftp client yet?

2021-10-31 Thread ToddAndMargo via perl6-users
On 10/30/21 19:08, Ralph Mellor wrote: I don't understand what you are thinking. Hi Ralph, That is because I have not made myself clear enough. Or maybe you are trying to expand to something greater than I am asking. That is a hazard when dealing with mensches that love to be helpful: scope