On Sat, May 23, 2009 at 11:41 AM, David Nolen <dnolen.li...@gmail.com> wrote: > > Put them in a namespace. > > (ns prime-seive) > > ... definitions ...
Yes, this would probably be best. Then you can use 'defn-' instead of 'defn' for all the function definitions that you want to keep private. Another option that is usually less desirable, but a good choice in some situations, is to move the functions you want to keep private into locals: (defn count-reversible [rev-max] (let [all-odd? (fn ...) reverse-num (fn ...) ...and so on...] {:max rev-max, :num-reversible ...})) This is generally not as nice because it makes updating the definitions while running more difficult, requires deeper nesting, separates the count-reversible args from its body, etc. But it does give you absolute protection from someone calling one of the private functions. There's a nice blog post here that covers several options for how to put together related functions: http://programming-puzzler.blogspot.com/2009/04/adts-in-clojure.html --Chouser --~--~---------~--~----~------------~-------~--~----~ 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 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 -~----------~----~----~----~------~----~------~--~---