I think that the examples should be part of the function definition.
I wouldn't think it wouldn't noticeably slow down running code (as it
would be ignored at run time).  Having the examples in the definition
would be the easiest way of having access at all times (say
programming on a laptop without network connection).  The examples in
the function definition could then be used to generate something like:
http://clojure-examples.appspot.com/clojure.core.  This is especially,
a good idea when working on a project with a number of other people.
Yes, it does produce longer files, but I would argue that they are
information dense.

Here is a simple example of what I would like to see as far as
information.

(defn tolerated-lt
  "Tolerated-less-than:
Computers will often represent a real number like 12.305 as
12.304999999999998,
thus (< 12.304999999999998 12.305) = true.  But since
12.30499999999998 was
supposed to be 12.305 the inequality should have been false.  This
function is
designed to correct this failure.

Usage: (tolerated-lt 12.304999999999998 12.305 10E-6) => false
Usage: (tolerated-lt 12.304999999999998 12.306 10E-6) => true"
  [a b tol]
      (and (< a b) (not (< (Math/abs (- a b))  tol))))
.

Well explained examples become more important as the function/macro
becomes more esoteric.  I have been programming almost exclusively in
clojure for a year and I still haven't been able to figure out,
clojure.zip.

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

Reply via email to