I am using racket v6.5 repl on linux and trying to run example of take function from the stream tutorial https://docs.racket-lang.org/functional-data-structures/streams.html.
However, instead of expected
> (take 3 (stream 1 2 3 4 5 6))
- : (Rec
g1827317
(U Null
(Boxof (U (Pairof Integer g1827317) (-> (Pairof Integer g1827317))))))
'#&#<procedure:.../pfds/stream.rkt:41:7>
I get
> (take 3 (stream 1 2 3 4 5 6))
take: contract violation
expected: exact-nonnegative-integer?
given: #<stream>
argument position: 2nd
other arguments...:
3
context...:
/usr/share/racket/collects/racket/list.rkt:151:0: take
/usr/share/racket/collects/racket/private/misc.rkt:87:7
>
take
function frompfds/stream
, or thetake
function fromracket/list
? You should be using the one frompfds/stream
. – Alex Knauth