Conway: Infinite work is less work

Damian Conway writes about the power of infinite sequences in Perl 6. The sequence of primes is just the sequence of positive integers, filtered (with a .grep) to keep only the ones that are prime. And, of course, Perl 6 already has a prime number tester: the built-in &is-prime function. The sequence of primes never changes, so we can declare it as a constant: constant p = [ (1..∞).grep( &is-prime ) ]; Now we need to extract just the strong and weak primes.

Continue Reading — Conway: Infinite work is less work

What is in your mind, about this post ? Leave a Reply

  Our next learning article is ready, subscribe it in your email

What is your Learning Goal for Next Six Months ? Talk to us