FAQ
# New Ticket Created by Zoffix Znet
# Please include the string: [perl #128176]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org/Ticket/Display.html?id=128176 >


When given a lazy list as the argument, .polymod divides until the original number given by the invocant reaches zero. That works when the lazy list is infinite, but when it isn't, we lose the final remainder. This affects both the Int and Real implementations. Here's a sample program demonstrating the issue:

     say 42.polymod: 2, 3;
     say 42.polymod: lazy 2, 3;

     say 42.Rat.polymod: 2, 3;
     say 42.Rat.polymod: lazy 2, 3;

     # OUTPUT:
     # (0 0 7)
     # (0 0)
     # (0 0 7)
     # (0 0)

Search Discussions

  • jnthn@jnthn.net via RT at May 19, 2016 at 8:32 pm

    On Wed May 18 07:56:18 2016, cpan@zoffix.com wrote:
    When given a lazy list as the argument, .polymod divides until the
    original number given by the invocant reaches zero. That works when
    the lazy list is infinite, but when it isn't, we lose the final
    remainder. This affects both the Int and Real implementations. Here's
    a sample program demonstrating the issue:

    say 42.polymod: 2, 3;
    say 42.polymod: lazy 2, 3;

    say 42.Rat.polymod: 2, 3;
    say 42.Rat.polymod: lazy 2, 3;

    # OUTPUT:
    # (0 0 7)
    # (0 0)
    # (0 0 7)
    # (0 0)
    It's worth noting that Perl 6 doesn't have a concept of infinite lists (that is, doesn't try to track that or make decisions based on it). Rather, a list (or sequence) can be marked lazy (or not). So however this gets changed (if at all), it'll want to be based on deciding what to do in the lazy vs. non-lazy case.

    /jnthn

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupperl6-compiler @
categoriesperl
postedMay 18, '16 at 2:56p
activeMay 19, '16 at 8:32p
posts2
users1
websiteperl6.org

1 user in discussion

jnthn@jnthn.net via RT: 2 posts

People

Translate

site design / logo © 2019 Grokbase