github.com/graybobo/golang.org-package-offline-cache@v0.0.0-20200626051047-6608995c132f/x/talks/2014/hellogophers/sieve.csp (about)

     1  [SIEVE(i:1..100):: 
     2      p,mp:integer; 
     3      SIEVE(i - 1)?p; 
     4      print!p; 
     5      mp := p; comment mp is a multiple of p; 
     6  *[m:integer; SIEVE(i - 1)?m →
     7      *[m > mp → mp := mp + p]; 
     8      [m = mp → skip 
     9      ||m < mp → SIEVE(i + 1)!m 
    10  ]   ] 
    11  ||SIEVE(0)::print!2; n:integer; n := 3; 
    12      *[n < 10000 → SIEVE(1)!n; n := n + 2] 
    13  ||SIEVE(101)::*[n:integer;SIEVE(100)?n → print!n] 
    14  ||print::*[(i:0..101) n:integer; SIEVE(i)?n → ...] 
    15  ]