Can I get some help with (map f coll)...
What I want to do is map a java function that takes 2 arguments over a
list
where the first argument is the index into the list itself
and the second argument is taken from the list
The problem being map uses a function of 1 argument.
Does that mean I need to create my own map, or is there a better way?
Specifically what I'm struggling with:
(def *scene-graph* (new javax.media.j3d.BranchGroup))
(defn poly [label points]
(let [la (new javax.media.j3d.LineArray (count points)
(.COORDINATES javax.media.j3d.LineArray)]
(map (memfn javax.media.j3d.LineArray.setCoordinate idx (new
javax.vecmath.Point3f x y 0) points)
(.addChild *scene-graph* (new javax.media.j3d.Shape3D la))))
The intention being that points is a list of x,y coordinates
I construct a LineArray which is the size of points
then for every point I need to call setCoordinate(index, Point3f(x,y))
The LineArray then makes a Shape3D which can be added to the scene
graph.
Regards,
Tim.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---