Did you know ... | Search Documentation: |
Pack nan_numerics_prime -- prolog/nan_numerics_prime_pio.pl |
Module prime_pio
provides low-level predicates to read/write from/to a
file or stream all consecutive prime numbers starting from 2
and up to a
certain limit that is determined by the caller.
The accepted file format is a comma-separated list of the consecutive
prime numbers starting from 2
and terminated by a period.
NOTE: Predicates in this module are not meant for public use.
Goal(Stream)
where Stream is
the opened I/O stream. Mode can be one of read
or write
. File is
automatically closed after Goal is finished.
Encoding of file is ascii
, type is text
, buffering is full
.
2
. For every read number greater
than 2
calls GAdd(+P0:prime +P:prime)
, where P0 is the
previously read number and P is the current number. Stops reading
either at end-of-stream or when the call to GAdd fails.
Encoding of stream is ascii
, type is text
, buffer size is 1024
.
NOTE: Does not check that the numbers read from the stream are
consecutive prime numbers starting from 2
.
2
, then writes all numbers generated by calling GGen(-P:prime)
,
where P shall be greater than 2
. Stops writing when bactracking on
GGen terminates.
Encoding of stream is ascii
, type is text
, buffering is full
,
buffer size is 1024
.
NOTE: Does not check that the numbers generated by GGen are
consecutive prime numbers starting from 3
.