In Clojure the abstraction is the sequence, rather than an iterator. The concept is similar.
On 11 Sep 2009, at 11:55 AM, carey wrote: > > Thanks Richard, that helps. I've not used iterators much (only in C++, > and they aren't nice there), I'll look this up. I have Halloways book > here, but that doesn' mention them, so its back to the boards I > guess :) > > On 11 Sep, 19:17, Richard Newman <holyg...@gmail.com> wrote: >>>> Where I'm stuck >>>> is how to get access to the particle names, as I would in the above >>>> line of Java code. >> >> The final bit, once you have an iterator over particles, would be: >> >> (fn [p] (.getName p)) >> >> To avoid the use of reflection, you might want explicit type >> annotations: >> >> (fn [#^Particle p] (.getName p)) >> >> As Lauri mentioned, you pass this to map. >> >> You can't just pass a Java method to map: Java methods are not first- >> class like Clojure functions. > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---