On Sun, 2013-01-13 at 19:03 +0100, Marcel Möhring wrote: > Currently I am using this approach but it feels rather clumsy: > > "Takes a screen and a pixel coordinate and returns > a map of maps with pixel colors > and adjusted pixel coordinates around the pixel. > Directions are degree numbers from 0 to 315. > in: screen (BufferedImage), x (Number), y (Number) > out: map of maps ({direction (Number) {:color (Number) :x (Number) > :y (Number)}})" > > Are there any better ways?
Using your argument names in prose is superior to saying the order, because you can read the order from other places. "Return a map of maps of pixel colors and coordinates on BUFFERED-IMAGE surrounding (X, Y). Directions are degree numbers from 0 to 315. out: map of maps ({direction (Number) {:color (Number) :x (Number) :y (Number)}})" ;; hey you have a lambda list saying where the args go [buffered-image x y] Also, here is a type annotation that documents your argument/return types and registers them with Typed Clojure[1] for type checking: (ann my-function [BufferedImage Number Number] -> (Option (Seqable ...))) Here is a version of that annotation that doesn't require Typed Clojure, or anything at all really, although you don't get the type checking: '(ann my-function [BufferedImage Number Number] -> (Option (Seqable ...))) [1] https://github.com/frenchy64/typed-clojure/wiki -- Stephen Compall ^aCollection allSatisfy: [:each|aCondition]: less is better -- 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