On Sep 11, 3:01 am, Allen Rohner <[EMAIL PROTECTED]> wrote:
> > For very short functions one can use the cut notation: #(...). In case
> > there are several functions or functions going over several lines, this
> > is a sign that they should go into an own defn(-) with appropriate
> > docstring.
>
> Maybe the solution is to use defn-. Scheme made me used to the local
> function approach for encapsulation. I don't have a problem with doing
>
> (defn foo [x]
>     (defn bar [y]
> )
>     (defn baz [z])
>     (do_stuff (bar[x]))
>
> except that the interior defns are public.

I like the idea. defn- would also work like this but that won't
prevent bar
and baz from being used inside the package itself.

(let [foo (fn [x]
                ...)]
   (foo 42))

Does tend to get a little ugly if fn grows more than a line or two.
Not sure how it can be done though.

Parth



--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to