I forgot to add the evaluations of my-test to itself ;;; ======================= ;;; evaluating my-test with doc string *after* param ;;; ======================= user> my-test #<user$my_test__2490 [EMAIL PROTECTED]> ;;; =======================
;;; ======================= ;;; evaluating my-test with doc string *before* param ;;; ======================= user> my-test #<user$my_test__2466 [EMAIL PROTECTED]> ;;; ======================= Here again the only difference is the placement of the (doc)string - which can't be discerned visually. On Dec 4, 12:57 am, Mon Key <[EMAIL PROTECTED]> wrote: > I'm sure I'm missing something.... > > Maybe I should re address the issue in a different way; outside of > `meta' what other way is there to do a *visual* check/comparison to > test if two otherwise identical and/or nearly identical symbols > contain identical slot values? > > In the case where the `doc' string (disregarding whether it is > actually a doc string or not) is placed after the param how does one > catch this (mis)placement when examining the `meta' on the symbol > returns nil? > > Following is the same series of evaluations at the REPL with better > annotation > > ;;; ======================= > ;;; evaluating my-test defn with doc string *after* param > ;;; ======================= > user> (defn my-test > [] > "misplaced documentation string for my-test" > (= my-test my-test)) > #'user/my-test > ;;; ======================= > ;;; evaluating my-test with doc string *after* param > ;;; ======================= > user> (my-test) > true > ;;; ======================= > ;; examining meta of my-test defn with doc string *after* param > ;;; ======================= > user> (meta (var my-test)) > {:ns #<Namespace user>, :file "NO_SOURCE_FILE", :name my- > test, :arglists ([]), :line 1} > ;;; ======================= > ;;; evaluating doc of my-test defn with doc string *after* param > ;;; ======================= > user> (doc my-test) > ------------------------- > user/my-test > ([]) > nil > nil > ;;; ======================= > ;;; evaluating my-test defn with doc string *before* param > ;;; ======================= > user> (defn my-test > "appropriately placed documentation string for my-test" > [] > (= my-test my-test)) > #'user/my-test > ;;; ======================= > ;;; evaluating my-test with doc string *before* param > ;;; ======================= > user> (my-test) > true > ;;; ======================= > ;; examining meta of my-test defn with doc string *before* param > ;;; ======================= > user> (meta (var my-test)) > {:ns #<Namespace user>, :doc "appropriately placed documentation > string for my-test", :file "NO_SOURCE_FILE", :name my-test, :arglists > ([]), :line 1} > ;;; ======================= > ;; evaluating doc of my-test defn with doc string *before* param > ;;; ======================= > user> (doc my-test) > ------------------------- > user/my-test > ([]) > appropriately placed documentation string for my-test > nil > ;;; ======================= > > On Dec 3, 11:58 pm, "Stephen C. Gilardi" <[EMAIL PROTECTED]> wrote: > > > On Dec 3, 2008, at 11:35 PM, Mon Key wrote: > > > > I apologize if this has been brought up before... But, where does > > > the doc string on the `my-test' defn below reside. > > > It becomes metadata for the var that your defn form defines. You can > > see all the metadata with (meta (var my-test)). > > > > If not, should I be able to defn with the doc string out of place > > > without first passing a keyword? > > > I don't understand the question about the keyword. > > > This is a valid function: > > > (defn hi [] "hello") > > > It's not a doc string out of place, it's a function that always > > returns the same string. > > > --Steve --~--~---------~--~----~------------~-------~--~----~ 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 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 -~----------~----~----~----~------~----~------~--~---