letfn is exactly what I was looking for.
Thank you.
On Feb 8, 12:15 pm, Michał Marczyk wrote:
> Use let:
>
> (defn foo [...]
> (let [helper (fn [...] ...)]
> (helper ...)))
>
> or letfn:
>
> (defn foo [...]
> (letfn [(helper [...] ...)]
> (helper ...)))
>
> The latter allows you to i
don't use def inside functions, ever. in scheme define is lexically scoped,
so you do that sort of thing. clojure is not scheme. if you want a lexically
scoped function use a lexical scoping construct like let or letfn.
On Mon, Feb 8, 2010 at 12:12 PM, Brenton wrote:
> What is the Clojure best p
Use let:
(defn foo [...]
(let [helper (fn [...] ...)]
(helper ...)))
or letfn:
(defn foo [...]
(letfn [(helper [...] ...)]
(helper ...)))
The latter allows you to introduce mutually recursive functions.
Sincerely,
Michał
--
You received this message because you are subscribed to