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 implement. It would probably be best 
to write a function that reads in nested xlisp alists and returns nested 
maps.

To add a key to a map in clojure (acons in xlisp) we use assoc. It is 
likely that xlisp allows multiple bindings to the same key in an alist - 
maps do not work that way and you would need something slightly more 
complex than just a map if you need that behavior.

To find a key in a map in clojure (assoc in xplisp) we use get. get is the 
function used if a map or keyword is used in the calling position.

On Sunday, November 17, 2013 11:09:56 PM UTC-8, hpw...@googlemail.com wrote:
>
> Hello,
>
> As a newbie coming from a autolisp/newLISP background I have a question 
> about using xlisp assoc-lists in clojure.
>
> I have huge databases form autolisp (from an autocad enviroment) in the 
> form of nested assoc-lists.
>
> Can I stay with that format and read them from clojure?
>
> The first would be to emulate 'setq' 
> This could be done with 'def' (with a single pair of symbol/expression)
> (By the way: Can a multiform of def be done like (defm symbol1 expression1 
> ....symboln expressionn) by a macro)
>
> The scond is the use of assoc-lists in clojure:
>
> Is it wise to use them in clojure for huge data-lists?
> How can I access them like I do in autolisp with it's 'assoc'.
> Finding the sublist by its first member.
> I do not see a equivalent command for lists in clojure.
> clojures assoc command is completly different.
> Can it be done with a macro?
>
>
> Regards
>
> Hans-Peter
>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to