I prefer to use closures / higher order functions that return a function. 
Reasons:
- You typically get much better performance by returning a closure. 
"partial" uses "apply", which adds a lot of overhead
- It can result in cleaner user code (partials require a bit of mental 
decoding, and you can give the closure-returning function a good, specific 
name)

On naming, I like to use the "er" suffix to imply that the return value is 
a function that will perform the relevant task. e.g.

(defn incrementer [value]
  (fn [x] (+ x value)))

((incrementer 3) 10)
=> 13

On Saturday, 17 August 2013 06:00:30 UTC+8, nodename wrote:
>
> (defn newgrid 
>
>   [m initialize qi qj]... 
>
>
> and then (let [init (partial newgrid m initialize)]... 
>
>
> Or else: 
>
>
> (defn newgrid 
>
>   [m initialize] 
>
>   (fn [qi qj]... 
>
>
> and then (let [init (newgrid m initialize)]... 
>

-- 
-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to