Infinite stream without elements
The answer depends on the exact type of streams you are using.
Basically there are two different types of streams:
- empty streams
- streams consisting of an element followed by an stream
Therefore you need two different types of values to represent the two types.
In SICP (sicp) they write:
There is a distinguishable object,
the-empty-stream
, which cannot be the result of anycons-stream
operation, and which can be identified with the predicatestream-null?
One way to define a distinguishable (unique) object in Scheme is to allocate an new cons cell - its address is unique to that cell.
(define the-empty-stream (list 'this-is-the-empty-stream))
(define (stream-null? x) (eq? x the-empty-stream))
In Racket one would simply use a struct to represent the empty stream
(struct the-empty-stream ())
(define stream-null? the-empty-stream?)
Functions such as stream->list
need to handle both types of lists.
Back to your question: If you are using SICP streams the answer is simple.
The expression the-empty-stream
will give you an empty stream.
If you are defining your own, you will need to choose a way to represent an empty stream - and then carefully modify all the stream functions you have to handle the empty stream too.