Arc Forumnew | comments | leaders | submitlogin
2 points by Darmani 5924 days ago | link | parent

Certainly, it may be possible to give this functionality to lists tagged with the type 'alist. But then what would it do when I want to find the zeroth element of an alist where 0 is a key? You could have it just default to one or the other, but then I'd just end up ignoring whichever indexing operation it doesn't default to and using a differently-named function all the time for the other type of indexing in general alist code. In which case, what's the point of overloading the function in the first place?


2 points by sbelmon 5923 days ago | link

No contest, my idea is half-baked. I had in mind symbols as keys, where you could define reasonable semantics. I'm still bugged by the lack of symmetry: For any X with which it makes some sense at all, (X ...) seems to work. Constants, hashes, strings, lists... even lambdas ;-)

Obviously the issue is that alists are only a convention.

-----