Source: prost.pl.

Here, "stream" is used in the sense of "sequence", "delayed list", "lazy list" etc. as in Structure and Interpretation of Computer Programs, not in the sense of a Prolog input/output stream.

The file contains the following examples of infinite streams (sequences): In all cases, you can take as many elements as you like. You can also print out elements using seq_print/1 and perform pairwise addition of sequences using seq_add/3.



A program making use of the sequence of primes is here. It finds Meertens numbers, i.e., natural numbers N such that N is its own Gödel number (see source for details).
      ?- time(meertens(M)).
      % 1,307,951,016 inferences, 1509.23 CPU in 1538.53 seconds (98% CPU, 866635 Lips)

      M = 81312000
    

Main page