[Gauche-devel] bimap not really a collection?
R7RS Scheme scripting engine
Status: Beta
Brought to you by:
shirok
|
From: Jens T. <ka...@be...> - 2010-07-29 17:44:37
|
hi,
is the following a bug?
gosh> (use gauche.dictionary)
#<undef>
gosh> (use gauche.collection)
#<undef>
gosh> (is-a? (make-bimap (make-hash-table 'string=?) (make-hash-table 'eqv?)) <collection>)
#t
gosh> (d (class-of (make-bimap (make-hash-table 'string=?) (make-hash-table 'eqv?))))
#<class <bimap>> is an instance of class <class>
slots:
name : <bimap>
cpl : (#<class <bimap>> #<class <dictionary>> #<class <collection>
direct-supers: (#<class <dictionary>> #<class <object>>)
accessors : ((left . #<slot-accessor <bimap>.left 0 :left>) (right . #<s
slots : ((left :init-keyword :left) (right :init-keyword :right))
direct-slots: ((left :init-keyword :left) (right :init-keyword :right))
num-instance-slots: 2
direct-subclasses: ()
direct-methods: (#<method (dict-fold <bimap> <top> <top>)> #<method (dict-de
initargs : (:name <bimap> :supers (#<class <dictionary>>) :slots ((left
defined-modules: (#<module gauche.dictionary>)
redefined : #f
category : scheme
gosh> (fold (lambda _ #t) #f (make-bimap (make-hash-table 'string=?) (make-hash-table 'eqv?)))
*** ERROR: no applicable method for #<generic call-with-iterator (6)> with arguments (#<<bimap> 0x9691c0> #<closure ((fold <top> <top> <collection>) #f)>)
real world context is that one:
gosh> (define-method col-empty? ((col <collection>))
#?=(call/cc
(lambda(cc)
(fold (lambda _ (cc #f))
#t
col))))
#<generic col-empty? (1)>
gosh> (col-empty? (make-bimap (make-hash-table 'string=?) (make-hash-table 'eqv?)))
#?="(stdin)":7:(call/cc (lambda (cc) (fold (lambda _ (cc #f)) #t col)))
*** ERROR: no applicable method for #<generic call-with-iterator (6)> with arguments (#<<bimap> 0x969ea0> #<closure ((fold <top> <top> <collection>) #f)>)
Stack Trace:
_______________________________________
0 (call/cc (lambda (cc) (fold (lambda _ (cc #f)) #t col)))
At line 7 of "(stdin)"
|