hello,
what's the common idiom in functional programming regarding checking
the validity of arguments to functions. i think this is called
defensive programming vs contract programming.
for example:
;; this first version of foo checks the validity of arguments inside
foo
(defn foo [context arg]
(if (arg-valid? arg)
(change-context context arg)
context))
;; this version assumes that the caller of foo fulfills the
preconditions of foo
(defn foo
"Precondition: (arg-valid? arg)"
[context arg]
(change context arg))
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---