chicken-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-hackers] [PATCH] alist-update: don't segfault on non-list


From: Christian Kellermann
Subject: Re: [Chicken-hackers] [PATCH] alist-update: don't segfault on non-list
Date: Sat, 16 Mar 2013 21:16:16 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

* Jim Ursetto <address@hidden> [130314 08:13]:
> Nice catch.  Actually, it might be better rewritten with (##sys#check-list 
> lst 'alist-update), although that is not that important.
> 
> Related, alist-update! behaves weird but doesn't crash on non-alists:
> 
> (alist-update! 'foo 'bar 3)
> ;=> ((foo . bar) . 3)
> 
> And it's inconsistent when you give it a comparator:
> 
> ;; this uses assoc
> (alist-update! 'foo 'bar '((a . b) 3 (c . d)) equal?)
> Error: (assoc) bad argument type: 3
> 
> ;; this uses an assoc-like loop which does not check for lists 
> (alist-update! 'foo 'bar '((a . b) 3 (c . d)) (cut equal? <> <>))
> ;=> ((foo . bar) (a . b) 3 (c . d))
> 

I propose the following patch, which checks the argument for both
procedures with the usual ##sys#check...

Kind regards,

Christian

-- 
In the world, there is nothing more submissive and weak than
water. Yet for attacking that which is hard and strong, nothing can
surpass it. --- Lao Tzu

Attachment: 0001-alist-update-don-t-segfault-on-non-list.patch
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]