[heresy-devel] null/ bug.

Robin Lee Powell rlpowell at digitalkingdom.org
Tue Sep 2 23:50:34 UTC 2008


That seems to work just fine.  Thanks!

-Robin

On Tue, Sep 02, 2008 at 06:38:47PM -0500, Matt Lamari wrote:
>
> 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
>>
>>   
>

-- 
Lojban Reason #17: http://en.wikipedia.org/wiki/Buffalo_buffalo
Proud Supporter of the Singularity Institute - http://singinst.org/
http://www.digitalkingdom.org/~rlpowell/ *** http://www.lojban.org/



More information about the heresy-devel mailing list