develooper Front page | perl.perl6.users | Postings from October 2021

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

Thread Previous | Thread Next
From:
Sean McAfee
Date:
October 31, 2021 18:18
Subject:
Re: how do I turn a real into and array of Integers?
Message ID:
CANan03YTkk7u=J0grxONLymG_CL7VvZOEidCTVKda7W+C_WLUA@mail.gmail.com
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/)

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