Add :examples option to s/fdef for documentation and testing?

80 views
Skip to first unread message

Peter Marklund

unread,
Aug 21, 2016, 9:26:24 AM8/21/16
to Clojure
Did you consider having examples (input-output mappings) be part of the spec for a function, i.e. add an :examples option to the fdef macro in addition to :the current args, :ret, and :fn options? There is nothing really like examples for learning and clojuredocs.org has been immensely useful for this reason. I figured that especially for functions with simple input-output mappings of primitive data having a few such representative mappings be part of the spec and the doc string would be natural. Those examples could of course also drive tests.

Alex Miller

unread,
Aug 21, 2016, 9:30:05 PM8/21/16
to Clojure
Hi Peter, thanks for the idea, but I don't expect that we'll add this.
Reply all
Reply to author
Forward
0 new messages