On Monday, March 11, 2013 2:18:32 AM UTC+1, Craig Ching wrote:

> Ok, I *think* I understand what you're saying.  I did try an anonymous 
> function at one point, but gave it up, I don't know why I did because it 
> ended up working pretty well after reading your advice.  How's this then?
>
> (defn- make-students
>   [teacher-name n]
>   (map #(make-student teacher-name (make-student-name %) 0)
>        (range n)))
>

Yes, that's how I'd write it. Let me also comment on another slight aspect:

(defn- make-student
>   [teacher-name
>    student-name
>    age] {:id (str teacher-name "!" student-name)
>            :TeacherName teacher-name
>            :StudentName student-name
>            :age age})


This kind if formatting hurts readability for people used to the style that 
most Clojure code adopts, which would look something like this:

(defn- make-student [teacher-name student-name age]
  {:id (str teacher-name "!" student-name)
   :TeacherName teacher-name
   :StudentName student-name
   :age age})

Placing the arguments vector on its own line is also an option, but you 
shouldn't start the body in the same line.

-- 
-- 
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