You could use type hints and pre/post conditions:
(defn foo
"Gets adjusted pixels or whatever"
[^BufferedImage screen ^Number x ^Number y]
{:post [(foo-map? %)]}
...)
(defn foo-map?
"True if x is a map of maps with pixel colors ..."
[x]
...)
That said, it would be nice if clojure.repl/doc printed type hints and
pre&post conditions. You can however use clojure.repl/source to see
pre&post conditions.
On Sunday, January 13, 2013 10:03:35 AM UTC-8, Marcel Möhring wrote:
>
> Hello,
>
> is there a better way to document a function if I want to include type
> information
> and parameters for in/out?
>
> 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?
>
> Thanks,
> Marcel
>
>
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
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