[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] sequences egg
From: |
Thomas Chust |
Subject: |
Re: [Chicken-users] sequences egg |
Date: |
Thu, 18 Nov 2010 22:55:47 +0100 |
2010/11/18 Felix <address@hidden>:
> [...]
> I've put together a little library of generic "sequence" operations,
> and would like to get some feedback, since I'm not sure about the
> nomenclature and API.
> [...]
Hello,
in my opinion this library is a good idea. A feature I would like to see in this
kind of library would be some comprehension mechanism (similar to SRFI-42 or
Racket's for comprehensions).
I also noticed that iterator operations are apparently broken when the iterator
is based on a list:
$ csi
CHICKEN
(c)2008-2010 The Chicken Team
(c)2000-2007 Felix L. Winkelmann
Version 4.6.3
linux-unix-gnu-x86 [ manyargs dload ptables ]
compiled 2010-11-12 on kali (Linux)
; [... *snip* loading modules ...]
#;1> (use sequences)
; [... *snip* loading modules ...]
#;2> (define l '(foo bar baz))
#;3> (define i (iterator l))
#;4> (elt l i)
Error: (elt0-generic) argument mismatch - was given `((foo bar baz)
#<iterator>)' but expected: ((elt0-generic<<list>-<fixnum>> <list>
<fixnum>) (elt0-generic<<vector>-<fixnum>> <vector> <fixnum>)
(elt0-generic<<vector>-<random-access-iterator>> <vector>
<random-access-iterator>) (elt0-generic<<string>-<fixnum>> <string>
<fixnum>) (elt0-generic<<string>-<random-access-iterator>> <string>
<random-access-iterator>)
(elt0-generic<<linear-sequence>-<linear-iterator>> <linear-sequence>
<linear-iterator>) (elt0-generic<<linear-sequence>-<fixnum>>
<linear-sequence> <fixnum>)
(elt0-generic<<random-access-sequence>-<random-access-iterator>>
<random-access-sequence> <random-access-iterator>)
(elt0-generic<<random-access-sequence>-<fixnum>>
<random-access-sequence> <fixnum>))
Call history:
<syntax> (elt l i)
<eval> (elt l i) <--
#;4> (advance i)
Error: bad argument type - not a structure of the required type
(foo bar baz)
linear-sequence
Call history:
<syntax> (advance i)
<eval> (advance i) <--
Ciao,
Thomas
--
When C++ is your hammer, every problem looks like your thumb.