Well it does not break referential transparency if both equalities (for 
input values and for results) are of a same kind. You would have to compare 
inputs by value and outputs by identity, if you want to percieve an 
inconsistency.

JW

On Saturday, February 8, 2014 6:49:39 PM UTC+1, Andy Fingerhut wrote:
>
> This might be too detailed a point, but I wanted to mention that while you 
> will always get the same order for the same collection (same as determined 
> by identical?, or Java ==, i.e. it is the same object in memory), you are 
> *not* guaranteed to get the same order for collections of the same type 
> that are equal to each other as determined by Clojure = or Java .equals.  
> In particular, if two values have the same hash value, then if they are 
> used as a set in a Clojure PersistentHashSet or a key in a 
> PersistentHashKey, they are put into a linear list in a hash bucket for 
> that hash value, and their order in that list can be different in different 
> sets/maps, and the order that (seq ...) returns on those sets/maps will be 
> different.
>
> I am not certain, but this might violate referential transparency 
> (replacing a value that is equals for another value in an expression will 
> always give you an equal result).
>
> I was curious whether anyone knows whether Haskell has hash-based data 
> structures like this, and do they somehow guarantee referential 
> transparency?  Perhaps by requiring the items to be sortable?
>
> Andy
>
>
> On Sat, Feb 8, 2014 at 8:19 AM, Jozef Wagner <jozef....@gmail.com<javascript:>
> > wrote:
>
>> Every persistent collection in Clojure supports conversion to the 
>> sequence of items. This is clearly documented in the official docs and 
>> there is no surprise here.
>>
>> The order or items in the resulting sequence is dependent on the 
>> collection type. As the conversion to the sequence is a referentially 
>> transparent function, you will always get the same order for the same 
>> collection. 
>>
>> JW
>>
>> On Saturday, February 8, 2014 4:59:47 PM UTC+1, Andy C wrote:
>>
>>> On Sat, Feb 8, 2014 at 12:06 AM, Sean Corfield <se...@corfield.org>wrote:
>>>
>>>> But you're misunderstanding what map does: it converts its collection
>>>> arguments to _sequences_ and then it processes those sequences. Map
>>>> doesn't operate on sets, or vectors, or maps, only on sequences.
>>>>
>>>
>>> Your assertion that I "am misunderstanding something" is wrong.
>>>
>>> One cannot convert amorphic set into linear sequence without assuming 
>>> certain order. And as with every assumption, it always comes with some less 
>>> or more pragmatic but arbitrary decision which might change over time and 
>>> ruin peoples programs. 
>>>
>>> I would expect Clojure to throw "IllegalArgumentException Don't know how 
>>> to create ISeq from: clojure.lang.PersistentHashSet" or document it 
>>> well in map somewhere.  
>>>
>>>
>>>  "Perfection is the enemy of the good."
>>>>
>>>
>>> Now judging by your sig, it all does not surprise me LOL
>>>
>>>
>>>
>>>  -- 
>> 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<javascript:>
>> 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 <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 clojure+u...@googlegroups.com <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 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