This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: assoc-ref and family


Klaus Schilling <Klaus.Schilling@home.ivm.de> writes:

> Greg Badros writes:
>  > Why is it that assoc takes KEY ALIST, whereas assoc-ref (and all the
>  > other guile alist procs) takes the arguments in the reverse order: ALIST 
>  > KEY?  Is this historical?  Since RnRS demands KEY ALIST, it seems it'd
>  > be nicer if assoc-ref used the same ordering.  Or at least the
> 
> No, it's nice that assoc-ref uses the same order as vector-ref or string-ref,
> so nothing unusual.

Fair enough.  I still claim the documentation should stress that assoc
and assoc-ref are different... based on your and Maciej's comments,
perhaps it belongs with assoc.  It's weird to go from:

(cdr (assoc KEY ALIST))

to 

(assoc-ref ALIST KEY)

but I now agree one wouldn't want to change the order of the latter.

Thanks!

Greg