Skip to content

Instantly share code, notes, and snippets.

@dogbert17
Last active April 24, 2016 10:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dogbert17/3135be4f816ec758fd1d294fbb551099 to your computer and use it in GitHub Desktop.
Save dogbert17/3135be4f816ec758fd1d294fbb551099 to your computer and use it in GitHub Desktop.
Preliminary attempt to document the polymod method in Int.pod
=head2 routine polymod
Defined as:
method polymod(Int:D: +@mods)
Usage:
INTEGER.polymod(LIST) # Is this correct ?
Returns a sequence of mod results corresponding to the divisors in @mods. # text taken verbatim from https://design.perl6.org/S32/Numeric.html
If the number of divisors is finite, returns one more result than the number
of divisors, and the final result is the remainder after all the divisions.
If the number of divisors is infinite, runs until the remainder is 0.
The Int version of this method assumes all the divisors are also integers.
Coerce the invocant to Num or Rat if you wish to use fractional operations.
say 3600.polymod(60,60,24); # (0 0 1 0) # perhaps more clearly explained examples are necessary ?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment