Macro question from a clojure newbie

2010-05-30 Thread Daniel
Hi all, I'm running into a problem where I need to define several functions and/or vars inside another function, but the function has multiple definitions and they all need to have access to the inner things. This could be solved by making private functions and using partial, but this sounds like

Re: Macro question from a clojure newbie

2010-05-30 Thread Erik Söhnel
Hi, Not really mechanisms, but two Idioms will help you with your problem: Either wrap the defn in a let: (let [U (gen-matrix [1 2 2 -2 -1 -2 2 2 3] 3 3) A (gen-matrix [1 2 2 2 1 2 2 2 3] 3 3) D (gen-matrix [-1 -2 -2 2 1 2 2 2 3] 3 3) S (gen-vector [3 4 5])] (letfn

Re: Macro question from a clojure newbie

2010-05-30 Thread Daniel
The first solution looks good. I had no idea that wrapping a defn inside of let's would leave the function exposed. Interesting. Is it considered idiomatic though? On May 30, 2:16 pm, Erik Söhnel eriksoeh...@googlemail.com wrote: Hi, Not really mechanisms, but two Idioms will help you with