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 convenient
read syntax?
user> (defn alput [m k v] (update-in m [k] conj v))
#'user/alput
user> (alput {} :a 0)
{:a (0)}
user> (alput {} :a 1)
{:a (1)}
user> (defn alget [m k] (first (get m k)))
#'user/alget
user> (alget '{:a (1 0)} :a)
1
user> (defn aldissoc [m k] (update-in m [k] rest))
#'user/aldissoc
user> (aldissoc '{:a (1 0)} :a)
{:a (0)}
user> (aldissoc *1 :a)
{:a ()}
On Wednesday, November 20, 2013 9:19:58 AM UTC-8, Gary Trakhman wrote:
>
> '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 (maybe not easy or familiar) components for
> manipulating data, which includes lists.
>
> We should understand the core principles and tradeoffs the language makes
> before making judgments like this.
>
>
> On Wed, Nov 20, 2013 at 12:03 PM, <[email protected] <javascript:>>wrote:
>
>> 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 compared in
>> list-processing functions a power horse.
>> But I do not want to blame the language at all, otherwise I would not be
>> interested.
>> I still have to find the best way to get the wanted job done with minimal
>> efforts.
>>
>> 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 [email protected]<javascript:>
>> Note that posts from new members are moderated - please be patient with
>> your first post.
>> To unsubscribe from this group, send email to
>> [email protected] <javascript:>
>> 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 [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.