[heresy-devel] null/ bug.
Matt Lamari
matthew.lamari at gmail.com
Tue Sep 2 23:38:47 UTC 2008
Would this do the job? Basically adding null and "t" types to the
typecase. . . Or am I missing a problem here
(defun null/ (list)
"Returns nil if list has contents, a value otherwise. Will only
traverse a single element for lazy-lists"
(etypecase list
(null t)
(list (null list))
(sequence (zerop (length list)))
(lazy-list-list-based (null (get-list-head list)))
(lazy-list-known-empty t)
(lazy-list (with-traversal-result (value next) (resolved
(get-traversal-result (get-call-for-first list))) (not (resolved next))))
(t nil)))
Robin Lee Powell wrote:
> On Tue, Sep 02, 2008 at 01:37:46PM -0700, Robin Lee Powell wrote:
>
>> IMO, membership predicates should never except, but:
>>
>> * (null/ 'e)
>>
>> debugger invoked on a SB-KERNEL:CASE-FAILURE in thread #<THREAD
>> "initial thread" RUNNING {100266AC71}>: E fell through ETYPECASE
>> expression. Wanted one of (LAZY-LIST HERESY::LAZY-LIST-KNOWN-EMPTY
>> HERESY::LAZY-LIST-LIST-BASED SEQUENCE LIST).
>>
>
> This turns out to be a more serious problem than I thought;
>
> (atom (list/ ))
>
> returns t, so the obvious fix of
>
> (or (atom x) (non-null/ x))
>
> doesn't work. On top of that, the "is a lazy list" predicate
> doesn't seem to be exported from Heresy. I had to add (atom nil) to
> the etypecase for null/, but really I think that should be a
> typecase with (t nil) at the end.
>
> -Robin
>
>
More information about the heresy-devel
mailing list