Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add tests and change `stream-empty' to `empty-stream'

  • Loading branch information...
commit b5aafa378eefc5737b3e3a4f128988a983b20ae0 1 parent 590ff99
@danking danking authored
View
2  collects/racket/stream.rkt
@@ -32,7 +32,7 @@
(define-syntax stream
(syntax-rules ()
((_)
- stream-empty)
+ empty-stream)
((_ hd tl ...)
(stream-cons hd (stream tl ...)))))
View
8 collects/tests/racket/stream.rktl
@@ -27,4 +27,12 @@
(test "hello" stream-first (sequence->stream (in-producer (lambda () "hello") (void))))
(test 65 stream-first (sequence->stream (in-port read-byte (open-input-string "A"))))
+(define one-to-four (stream 1 2 3 4))
+
+(test 1 stream-first one-to-four)
+(test 2 stream-ref one-to-four 1)
+(test 3 stream-ref one-to-four 2)
+(test 4 stream-ref one-to-four 3)
+(test #t stream-empty? (stream-rest (stream 1)))
+
(report-errs)
Please sign in to comment.
Something went wrong with that request. Please try again.