No, what I'm saying is that in each persistent collection there is a method
called "cons":

https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/PersistentVector.java#L167

However, this is the function called by clojure.core/conj:

https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L75
https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L562

Compare this to what clojure.core/cons calls:
https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L22
https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L565

Basically, clojure.core/cons always converts the collection to a seq, then
creates a Cons cell. Conj dispatches to coll.cons and runs whatever code
the collection considers best.

Timothy


On Wed, May 22, 2013 at 10:00 AM, John Jacobsen <eigenhom...@gmail.com>wrote:

> I am indeed confused.  I have both cons and conj operations in my table.
>  Are you saying (conj coll item) and (cons item coll) are implemented the
> same way under the hood?  That wasn't my understanding.  Can you clarify?
>
>
> On Wednesday, May 22, 2013 10:05:22 AM UTC-5, tbc++ wrote:
>
>> You might also want to switch "cons" to "conj". This is a super ugly part
>> of the Java api that no one really ever sees. PersistentVector.cons is
>> actually called by clojure.core/conj. clojure.core/cons is something else
>> completely. When talking about how the java code performs it might be best
>> to specify which one you mean.
>>
>> Yes it's confusing, I'm sure there is a historical reason for it.
>>
>> Timothy
>>
>>
>> On Wed, May 22, 2013 at 8:24 AM, John Jacobsen <eigen...@gmail.com>wrote:
>>
>>> I should probably also have added sorted-map to the table, though the
>>> complexity for each operation is less clear to me.
>>>
>>> --
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To post to this group, send email to clo...@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+u...@**googlegroups.com
>>>
>>> For more options, visit this group at
>>> http://groups.google.com/**group/clojure?hl=en<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+u...@**googlegroups.com.
>>>
>>> For more options, visit 
>>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
>>> .
>>>
>>>
>>>
>>
>>
>>
>> --
>> “One of the main causes of the fall of the Roman Empire was that–lacking
>> zero–they had no way to indicate successful termination of their C
>> programs.”
>> (Robert Firth)
>>
>  --
> --
> 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.
>
>
>



-- 
“One of the main causes of the fall of the Roman Empire was that–lacking
zero–they had no way to indicate successful termination of their C
programs.”
(Robert Firth)

-- 
-- 
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