On Mon, Apr 8, 2013 at 4:02 PM, JvJ <[email protected]> wrote:

>
> Even though the behaviour of lists and vectors differs under specific
> functions, they still count as equal, but this statement "If a = b, then (f
> a) = (f b)" seems like it would be some sort of rule or axiom about
> functional programming.  What's the FP purists' view on this?
>

You don't even need different types for this:

user> (deftype Perverse? [a b]
                           Object
                           (equals [this other] (= a (.a other))))
user.Perverse?
user> (defn f [^Perverse? p]
                           (Perverse?. (.b p) (.a p)))
#'user/f
user> (= (->Perverse? 1 2) (->Perverse? 1 4))
true
user> (= (f (->Perverse? 1 2)) (f (->Perverse? 1 4)))
false
user>

-- 
Ben Wolfson
"Human kind has used its intelligence to vary the flavour of drinks, which
may be sweet, aromatic, fermented or spirit-based. ... Family and social
life also offer numerous other occasions to consume drinks for pleasure."
[Larousse, "Drink" entry]

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


Reply via email to