Prolog Streams



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.



A program making use of the sequence of primes is meertens.pl. 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