Re: Using xlisp assoc-lists in clojure

2013-11-21 Thread Justin Smith
The issue, as far as I am concerned, is not that clojure cannot do alists as any traditional lisp would (it can, quite easily, as has already been shown). The real question is why you would use a linked list for associative data, when you have an associative type with better lookup time and a c

Re: Using xlisp assoc-lists in clojure

2013-11-20 Thread Gary Trakhman
'Relatively bad at lists' ? I think the thing that clojure's intentionally bad at is arbitrary nested mutation, so you're forced to be recursive about things and return values (this is how update-in and assoc-in are implemented), but this has nothing to do with data type. Clojure provides simple

Re: Using xlisp assoc-lists in clojure

2013-11-20 Thread hpw014
Hello, Thanks for the answers and code hints. What a bit surprise me, is the fact that clojure is announced as 'a lisp' and is relativ poor on working with lists. A long time ago I learned that 'lisp' was the agronym for 'ListProcessing'. ;-) As I note, I am a longtime user of newLISP which is

Re: Using xlisp assoc-lists in clojure

2013-11-18 Thread Cedric Greevey
It would probably be better to convert to/from normal Clojure maps at the edges of the Clojure code. If the input is '((k1 v1) (k2 v2) (k3 v3) (k1 v4)) and we want the earliest occurrence of k1 to "win", then that suggests (into {} (reverse alist)). If the input's flattened that would be (into {} (

Re: Using xlisp assoc-lists in clojure

2013-11-18 Thread Tassilo Horn
Justin Smith writes: Hi Justin & Hans-Peter, > Typically in clojure we use hash-maps (represented literally as {}) > where other lisps would use an alist. One difference between alists and maps is that in alists a "key" can occur multiple times, and then the first entry with that key shadows al

Re: Using xlisp assoc-lists in clojure

2013-11-18 Thread Justin Smith
Typically in clojure we use hash-maps (represented literally as {}) where other lisps would use an alist. Regarding reading assoc list literals, I wouldn't be surprised if someone had written this function already, but I doubt it is in the core language. I also don't think it would be hard to i