[plt-scheme] how do you use stream-partition?

From: Doug Orleans (dougorleans at gmail.com)
Date: Fri Mar 14 19:40:58 EDT 2008

I want to use stream-partition from dherman's stream.plt, which uses
SRFI-40 streams, but I can't figure out what to do with the result:

  Welcome to MzScheme v3.99.0.10 [3m], Copyright (c) 2004-2008 PLT Scheme Inc.
  Reading .mzschemerc...
  > (require srfi/40)
  > (define (integers-starting-from n)
      (stream-cons n (integers-starting-from (+ n 1))))
  > (require (planet "stream.ss" ("dherman" "stream.plt" 1 0)))
  > (stream->list (stream-take 5 (integers-starting-from 0)))
  (0 1 2 3 4)
  > (define-values (evens odds)
      (stream-partition even? (integers-starting-from 0)))
  define-values: context (defining "evens", ...) expected 2 values, received 1 value: #<stream>

   === context ===

  > (stream? (stream-partition even? (integers-starting-from 0)))
  > (stream-pair? (stream-partition even? (integers-starting-from 0)))
  context (lexical binding) expected 2 values, received 1 value: #<stream>

   === context ===
  /usr/local/plt/collects/srfi/40/stream.ss:82:2: stream-pair?

Neither module provides a stream-force, and all the stream functions
expect a delayed single value, so what can I do with this stream?

--dougorleans at gmail.com

Posted on the users mailing list.