Hi,

This is a newb question so apologies in advance if I haven't read
enough Clojure code yet to see the answer.

Suppose I need mathematical 2D vector functions:


(ns geometry.vector)

(defstruct vector :x :y)

(defn +
        "Add vectors v and w, yielding a vector"
        [ v w ]
        (...))

Which leads to the core "vector" function being shadowed by my struct
and the core "+" function shadowed by my function.  What is the
idiomatic Clojure approach for handling this situation?  Is it through
careful use of :require and :import parts of a (ns ...) form?

I've also seen instances of naming changes to avoid the problem, e.g.
(defstruct <vector> ...) and (defn vector+ ...)
but not sure if that's making best use of Clojure namespaces?

Any advice much appreciated,

Stu

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

Reply via email to