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

Re: Any other way to do this

Thread Previous | Thread Next
From:
Brian Duggan
Date:
September 1, 2020 15:27
Subject:
Re: Any other way to do this
Message ID:
20200901152655.GA32260@BD-C02WV0VKHTDD
On Monday, August 31, Bruce Gray wrote: 
> I finally settled on using `try` instead of numeric coercion, because
> if I am not golfing, I think `try` makes the grep look more like
> “filter out the non-numbers” instead of “get rid of the zero values”.

Another option is to use 'val' -- which parses it as a literal --

  $ raku -e 'say @*ARGS.map: { val($_) ~~ Numeric }' 1 2 3 a 1e10
   (True True True False True)

Brian

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