[cl-containers-devel] newbie problem with search-for-item wihtout :key & :test.

Gary King gwking at metabang.com
Wed Oct 29 02:47:41 UTC 2008


Hi Thanks for the question,

It certainly looks like something has gone awry somewhere. I'll try to  
look at this in the morning.

regards,

On Oct 28, 2008, at 6:10 PM, Szymon wrote:

> ;;; Hi,
> ;; I just asdf-ed cl-containers, and my first example failed ;(
> ;; Imho according to docs this should work
>
> (require :cl-containers)
>
> (use-package :metabang.cl-containers)
>
> (defclass x ()
>   ((letter :accessor x-letter :initarg :letter :type string)
>    (name   :accessor x-name   :initarg :name   :type string)))
>
> (defparameter *container-of-x*
>   (make-container 'list-container :key #'x-letter :test #'string=))
>
> (insert-list *container-of-x*
>              (map 'list
>                   (lambda (c) (make-instance 'x :letter (string  
> c) :name (char-name c)))
>                    
> "АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ"))
> ;;
> ;; OK:
> ;;
>
> (search-for-item *container-of-x* "Ж" :test #'string= :key #'x- 
> letter)
>
> ;;
> ;; FAILs:
> ;;
>
> (search-for-item *container-of-x* "Ж")
>
> ;; The value #<X {BC9CDC9}>
> ;; is not of type
> ;;   (OR (VECTOR CHARACTER) (VECTOR NIL) BASE-STRING SYMBOL
> ;;       CHARACTER).
> ;;    [Condition of type TYPE-ERROR]
> ;;
> ;; Restarts:
> ;;  0: [ABORT] Return to SLIME's top level.
> ;;  1: [TERMINATE-THREAD] Terminate this thread (#<THREAD "worker"  
> RUNNING {B59BB21}>)
> ;;
> ;; Backtrace:
> ;;   0: (STRING= "Ж" #<X {BC9CDC9}>)[:EXTERNAL]
> ;;   1: (FIND "Ж" (#<X {BC9CDC9}> #<X {BC9CDD9}> #<X {BC9CDE9}> #<X  
> {BC9CDF9}> #<X {BC9CE09}> #<X {BC9CE19}> ...))[:EXTERNAL]
> ;;       Locals:
> ;;         SB-DEBUG::ARG-0 = 6
> ;;         SB-DEBUG::ARG-1 = "Ж"
> ;;         SB-DEBUG::ARG-2 = (#<X {BC9CDC9}> #<X {BC9CDD9}> #<X  
> {BC9CDE9}> #<X {BC9CDF9}> #<X {BC9CE09}> #<X {BC9CE19}> ...)
>
> ;; Regards, Szymon.
>
> _______________________________________________
> cl-containers-devel mailing list
> cl-containers-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/cl-containers-devel

--
Gary Warren King, metabang.com
Cell: (413) 559 8738
Fax: (206) 338-4052
gwkkwg on Skype * garethsan on AIM








More information about the cl-containers-devel mailing list