the words method is extracting items from an input string. The $limit
parameter tells the words method to extract not more than $limit items from
the string. Setting the default to Inf only tells the  method to extract as
many items as it can from the input (i.e. to process the whole string),
without any limit. But since the input string cannot be infinite, the
number of items will also not be infinite. So, the Inf default for $limit
just states that there is no limit, but you'll never get an infinity of
items from a non-infinite string.



Le ven. 28 sept. 2018 à 19:31, ToddAndMargo <toddandma...@zoho.com> a
écrit :

> On 9/26/18 11:34 PM, JJ Merelo wrote:
> >
> >
> > El mié., 26 sept. 2018 a las 23:31, Laurent Rosenfeld via perl6-users
> > (<perl6-us...@perl.org <mailto:perl6-us...@perl.org>>) escribió:
> >
> >     You can set a limit to the number of items (words) you want to
> >     retrieve: you will get only the first $limit words.
> >
> >     If you don't supply any limit, Inf can be thought as the default
> >     value for the number of items, i.e. there is no limit and the
> >     routine will return as many words as it can from the source input.
> >
> >
> > And this is one of the things I love Perl 6 for, its consistency.
> > Infinity is literally no limit. Using it meaning "no limit" is genius.
> > Not "0 in this case means no limit" or "-1 means no limit" or "this
> > constant meaning unavailable" or whatever. Infinity has no limit, we use
> > them as a parameter to imply that argument has no limit.
> >
> > Cheers
> >
> > JJ
>
>
> Hi JJ,
>
> The more I learn about Perl 6, the more I prefer it over Perl 5.
>
> To your list, I might add, everything starts counting from zero
> (Perl5 m/ starts at $1).  So no guessing!
>
> My problem with the default set to Inf is that Inf means a number
> too large for the numbers of bits allocated to the variable to
> handle.
>
> RTFM: https://docs.perl6.org/type/Num#index-entry-Inf_%28definition%29-Inf
>       The value Inf is an instance of Num and represents value that's
>       too large to represent in 64-bit double-precision floating
>       point number (roughly, above 1.7976931348623158e308 for
>       positive Inf and below -1.7976931348623157e308 for negative Inf)
>       as well as returned from certain operations as defined by the
>       IEEE 754-2008 standard.
>
> So how am I suppose to enter that as a value?  What it really means
> is "all of them".  "Inf" is just a poor way of stating "all words"
> as the default.  "A tremendously large numbers of words" is just
> a weird way of saying "all of them".
>
> And yes, I am blanking on how to best clean that up. We have no
> value (that I know of) for "all".
>
> -T
>

Reply via email to