[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-users] stream-filter
From: |
Thomas Hafner |
Subject: |
[Chicken-users] stream-filter |
Date: |
20 Aug 2006 13:14:34 +0200 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 |
Hello,
according to <http://srfi.schemers.org/srfi-40/srfi-40.html>
stream-filter should be used like this
(stream-filter predicate? stream)
so I've tried that:
(require-extension srfi-40)
(define s0 (stream-delay (stream-cons "foo" stream-null)))
(define s1 (stream-filter (lambda x #t) s0))
(printf "~a\n" (stream-car s0))
(printf "~a\n" (stream-car s1))
Unfortunately but it fails. Without the last code line the output is
still ok:
|Version 2, Build 41 - linux-unix-gnu-x86-64 - [ 64bit dload ptables applyhook ]
|(c)2000-2006 Felix L. Winkelmann
|; loading ./filefind.scm ...
|; loading library posix ...
|; loading /usr/local/lib/chicken/1/srfi-40.scm ...
|; loading /usr/local/lib/chicken/1/srfi-40-base.so ...
|foo
But including the last code line something goes wrong:
|Version 2, Build 41 - linux-unix-gnu-x86-64 - [ 64bit dload ptables applyhook ]
|(c)2000-2006 Felix L. Winkelmann
|; loading ./filefind.scm ...
|; loading library posix ...
|; loading /usr/local/lib/chicken/1/srfi-40.scm ...
|; loading /usr/local/lib/chicken/1/srfi-40-base.so ...
|foo
|Error: (car) bad argument type: ()
|
| Call history:
|
| <eval> (##sys#list (quote lambda) (quote ()) exp)
| <eval> (##srfi-40#make-stream (stream-low-level-lazy
(stream-cons "foo" stream-null)))
| <eval> (vector (cons (quote suspension) (lambda ()
(stream-cons "foo" stream-null))))
| <eval> (cons (quote suspension) (lambda () (stream-cons "foo"
stream-null)))
| <eval> (stream-filter (lambda x #t) s0)
| <eval> (printf "~a\n" (stream-car s0))
| <eval> (stream-car s0)
| <eval> (##srfi-40#make-stream (stream-low-level-delay (let
((g0 stream-null)) (if (not (stream? g0)) (stream-error "attempt to...
| <eval> (vector (cons (quote suspension) (lambda ()
(stream-low-level-strict (let ((g0 stream-null)) (if (not (stream? g0))
(str......
| <eval> (cons (quote suspension) (lambda ()
(stream-low-level-strict (let ((g0 stream-null)) (if (not (stream? g0))
(stream-erro......
| <eval> (stream-low-level-strict (let ((g0 stream-null)) (if
(not (stream? g0)) (stream-error "attempt to stream-cons onto non-...
| <eval> (not (stream? g0))
| <eval> (stream? g0)
| <eval> (cons "foo" g0)
| <eval> (printf "~a\n" (stream-car s1))
| <eval> (stream-car s1) <--
What's going on? What am I doing wrong?
I've installed eggs srfi-40 and stream-ext (v1.4.1). All is running on
Linux, kernel 2.6.15-23-amd64-k8 as distributed by Ubuntu.
Regards
Thomas
- [Chicken-users] stream-filter,
Thomas Hafner <=