Permalink
Browse files

Update latest ClojureDocs.org snapshot to September 16, 2012

  • Loading branch information...
1 parent 3d4176e commit 8d91828314f2bfa63ca37340435fb1e9a293a821 @jafingerhut committed Sep 17, 2012
Showing with 399 additions and 59 deletions.
  1. +399 −59 snapshots/clojuredocs-snapshot-latest.txt
View
458 snapshots/clojuredocs-snapshot-latest.txt
@@ -1,4 +1,4 @@
-{:snapshot-time "Fri Aug 17 22:02:19 PDT 2012",
+{:snapshot-time "Sun Sep 16 18:31:51 PDT 2012",
:snapshot-info
{"clojure.zip/insert-right"
{:comments [],
@@ -3800,6 +3800,19 @@
:line "4124",
:arglists_comp "[a idx ret init expr]",
:url_friendly_name "areduce",
+ :file "clojure/core.clj"}
+ {:namespace_id 99,
+ :weight 3,
+ :name "map",
+ :updated_at "2010-10-20 05:22:45.0",
+ :version "1.2.0",
+ :created_at "2010-07-14 20:22:06.0",
+ :added nil,
+ :url "http://clojuredocs.org/v/1734",
+ :line "2079",
+ :arglists_comp
+ "[f coll]|[f c1 c2]|[f c1 c2 c3]|[f c1 c2 c3 & colls]",
+ :url_friendly_name "map",
:file "clojure/core.clj"}],
:examples
[{:namespace_id 99,
@@ -4879,9 +4892,9 @@
:body "In normal code, `eval` is rarely used."}],
:see-alsos
[{:namespace_id 99,
- :weight 3,
+ :weight 4,
:name "read-string",
- :updated_at "2010-12-01 15:32:37.0",
+ :updated_at "2012-08-20 22:21:54.0",
:version "1.2.0",
:created_at "2010-07-14 20:21:47.0",
:added nil,
@@ -5295,7 +5308,29 @@
:lib_version "1.3.0",
:library_id 15,
:body
- "user=> (read-string \"; foo\\n5\")\n5\n\nuser=> (read-string \"#^String x\")\nx\n\nuser=> (read-string \"(1)\")\n(1)\n\nuser=> (read-string \"(+ 1 2) (- 3 2)\")\n(+ 1 2)\n\nuser=> (read-string \"@a\")\n(clojure.core/deref a)\n\nuser=> (read-string \"(+ 1 2))))))\")\n(+ 1 2)\n\nuser=> (read-string \"::whatever-namespace-you-are-in\")\n:user/whatever-namespace-you-are-in"}],
+ "user=> (read-string \"; foo\\n5\")\n5\n\nuser=> (read-string \"#^String x\")\nx\n\nuser=> (read-string \"(1)\")\n(1)\n\nuser=> (read-string \"(+ 1 2) (- 3 2)\")\n(+ 1 2)\n\nuser=> (read-string \"@a\")\n(clojure.core/deref a)\n\nuser=> (read-string \"(+ 1 2))))))\")\n(+ 1 2)\n\nuser=> (read-string \"::whatever-namespace-you-are-in\")\n:user/whatever-namespace-you-are-in"}
+ {:namespace_id 99,
+ :ns "clojure.core",
+ :updated_at "2012-08-20 22:23:20.0",
+ :function "read-string",
+ :version 2,
+ :created_at "2012-08-20 22:21:54.0",
+ :library "Clojure Core",
+ :lib_version "1.2.0",
+ :library_id 3,
+ :body
+ ";convert a string representing a sequence,\n;to the sequence that the string represents\nuser=> (read-string \"(\\\\( \\\\x \\\\y \\\\) \\\\z)\")\n(\\( \\x \\y \\) \\z)\n\n;then you can convert to the string that the string-sequence represents\nuser=> (apply str (read-string \"(\\\\( \\\\x \\\\y \\\\) \\\\z)\"))\n\"(xy)z\"\n\n;which is the inverse of\nuser=> (str (first (list (seq \"(xy)z\"))))\n\"(\\\\( \\\\x \\\\y \\\\) \\\\z)\""}
+ {:namespace_id 330,
+ :ns "clojure.core",
+ :updated_at "2012-09-05 04:19:54.0",
+ :function "read-string",
+ :version 1,
+ :created_at "2012-09-05 04:19:54.0",
+ :library "Clojure Core",
+ :lib_version "1.3.0",
+ :library_id 15,
+ :body
+ ";; you can think of read-string as the inverse of pr-str\n;; turn string into symbols\nuser=> (read-string \"(a b foo :bar)\")\n(a b foo :bar)\n\n;;turn symbols into a string\nuser=> (pr-str '(a b foo :bar))\n\"(a b foo :bar)\""}],
:id 5704,
:name "read-string",
:ns "clojure.core",
@@ -5912,15 +5947,15 @@
:body "user=> (lazy-cat [1 2 3] [4 5 6])\n(1 2 3 4 5 6)\n"}
{:namespace_id 330,
:ns "clojure.core",
- :updated_at "2012-03-26 09:03:05.0",
+ :updated_at "2012-09-11 16:26:20.0",
:function "lazy-cat",
- :version 2,
+ :version 3,
:created_at "2012-03-26 09:01:23.0",
:library "Clojure Core",
:lib_version "1.3.0",
:library_id 15,
:body
- "(def fib-seq\n (lazy-cat [0 1] (map + (rest fib-seq) fib-seq)))\n\n(take 10 fib-seq)"}],
+ ";; N.B. this example holds onto the head of a lazy seq which should generally be avoided\n(def fib-seq\n (lazy-cat [0 1] (map + (rest fib-seq) fib-seq)))\n\n(take 10 fib-seq)"}],
:id 5578,
:name "lazy-cat",
:ns "clojure.core",
@@ -6513,7 +6548,29 @@
:lib_version "1.3.0",
:library_id 15,
:body
- "; Demonstrating difference between :when and :while\nuser=> (for [x (range 3) y (range 3) :when (not= x y)] [x y])\n([0 1] [0 2] [1 0] [1 2] [2 0] [2 1])\nuser=> (for [x (range 3) y (range 3) :while (not= x y)] [x y])\n([1 0] [2 0] [2 1])"}],
+ "; Demonstrating difference between :when and :while\nuser=> (for [x (range 3) y (range 3) :when (not= x y)] [x y])\n([0 1] [0 2] [1 0] [1 2] [2 0] [2 1])\nuser=> (for [x (range 3) y (range 3) :while (not= x y)] [x y])\n([1 0] [2 0] [2 1])"}
+ {:namespace_id 330,
+ :ns "clojure.core",
+ :updated_at "2012-08-23 15:24:32.0",
+ :function "for",
+ :version 1,
+ :created_at "2012-08-23 15:24:32.0",
+ :library "Clojure Core",
+ :lib_version "1.3.0",
+ :library_id 15,
+ :body
+ ";; More examples illustrating the difference between :when and :while\n\n;; Simple but inefficient method of checking whether a number is\n;; prime.\nuser=> (defn prime? [n]\n (not-any? zero? (map #(rem n %) (range 2 n))))\n#'user/prime?\n\nuser=> (range 3 33 2)\n(3 5 7 9 11 13 15 17 19 21 23 25 27 29 31)\n\n;; :when continues through the collection even if some have the\n;; condition evaluate to false, like filter\nuser=> (for [x (range 3 33 2) :when (prime? x)]\n x)\n(3 5 7 11 13 17 19 23 29 31)\n\n;; :while stops at the first collection element that evaluates to\n;; false, like take-while\nuser=> (for [x (range 3 33 2) :while (prime? x)]\n x)\n(3 5 7)\n\n;; The examples above can easily be rewritten with filter or\n;; take-while. When you have a for with multiple binding forms, so\n;; that the iteration occurs in a nested fashion, it becomes possible\n;; to write something briefly with 'for' that would be more verbose or\n;; unwieldy with nested filter or take-while expressions.\n\nuser=> (for [x (range 3 17 2) :when (prime? x)\n y (range 3 17 2) :when (prime? y)]\n [x y])\n([ 3 3] [ 3 5] [ 3 7] [ 3 11] [ 3 13]\n [ 5 3] [ 5 5] [ 5 7] [ 5 11] [ 5 13]\n [ 7 3] [ 7 5] [ 7 7] [ 7 11] [ 7 13]\n [11 3] [11 5] [11 7] [11 11] [11 13]\n [13 3] [13 5] [13 7] [13 11] [13 13])\n\nuser=> (for [x (range 3 17 2) :while (prime? x)\n y (range 3 17 2) :while (prime? y)]\n [x y])\n([3 3] [3 5] [3 7]\n [5 3] [5 5] [5 7]\n [7 3] [7 5] [7 7])\n\n;; This example only gives a finite result because of the :while\n;; expressions.\nuser=> (for [x (range) :while (< x 10) \n y (range) :while (<= y x)]\n [x y])\n\n([0 0]\n [1 0] [1 1]\n [2 0] [2 1] [2 2]\n [3 0] [3 1] [3 2] [3 3]\n [4 0] [4 1] [4 2] [4 3] [4 4]\n [5 0] [5 1] [5 2] [5 3] [5 4] [5 5]\n [6 0] [6 1] [6 2] [6 3] [6 4] [6 5] [6 6]\n [7 0] [7 1] [7 2] [7 3] [7 4] [7 5] [7 6] [7 7]\n [8 0] [8 1] [8 2] [8 3] [8 4] [8 5] [8 6] [8 7] [8 8]\n [9 0] [9 1] [9 2] [9 3] [9 4] [9 5] [9 6] [9 7] [9 8] [9 9])\n"}
+ {:namespace_id 330,
+ :ns "clojure.core",
+ :updated_at "2012-08-23 15:24:58.0",
+ :function "for",
+ :version 1,
+ :created_at "2012-08-23 15:24:58.0",
+ :library "Clojure Core",
+ :lib_version "1.3.0",
+ :library_id 15,
+ :body
+ ";; Here are a couple of examples where the only difference is where\n;; the :while is placed, but it makes a significant difference in the\n;; behavior.\n\n;; When x=2 y=1 is reached, :while (<= x y) evaluates false, so all\n;; further items in the y collection are skipped. When x=3 y=1 is\n;; reached, the same thing happens.\n\nuser=> (for [x [1 2 3]\n y [1 2 3]\n :while (<= x y)\n z [1 2 3]]\n [x y z])\n([1 1 1] [1 1 2] [1 1 3]\n [1 2 1] [1 2 2] [1 2 3]\n [1 3 1] [1 3 2] [1 3 3])\n\n;; This is different. When x=2 y=1 z=1 is reached, :while (<= x y)\n;; evaluates false, but since the :while is after the binding for z,\n;; all further items in the z collection are skipped. Then x=2 y=2\n;; z=1 is tried, where the while expresssion evaluates true.\n\nuser=> (for [x [1 2 3]\n y [1 2 3]\n z [1 2 3]\n :while (<= x y)]\n [x y z])\n([1 1 1] [1 1 2] [1 1 3]\n [1 2 1] [1 2 2] [1 2 3]\n [1 3 1] [1 3 2] [1 3 3]\n [2 2 1] [2 2 2] [2 2 3]\n [2 3 1] [2 3 2] [2 3 3]\n [3 3 1] [3 3 2] [3 3 3])\n"}],
:id 5522,
:name "for",
:ns "clojure.core",
@@ -8056,7 +8113,19 @@
:url "http://clojuredocs.org/v/3279"},
"clojure.template/apply-template"
{:comments [],
- :see-alsos [],
+ :see-alsos
+ [{:namespace_id 114,
+ :weight 2,
+ :name "do-template",
+ :updated_at "2010-10-20 04:42:18.0",
+ :version "1.2.0",
+ :created_at "2010-07-14 20:28:01.0",
+ :added nil,
+ :url "http://clojuredocs.org/v/2487",
+ :line "45",
+ :arglists_comp "[argv expr & values]",
+ :url_friendly_name "do-template",
+ :file "clojure/template.clj"}],
:examples
[{:namespace_id 114,
:ns "clojure.template",
@@ -8162,6 +8231,18 @@
:line "630",
:arglists_comp "[atype & proto+mmaps]",
:url_friendly_name "extend",
+ :file "clojure/core_deftype.clj"}
+ {:namespace_id 99,
+ :weight 3,
+ :name "defprotocol",
+ :updated_at "2010-11-15 06:13:53.0",
+ :version "1.2.0",
+ :created_at "2010-07-14 20:25:50.0",
+ :added nil,
+ :url "http://clojuredocs.org/v/2062",
+ :line "576",
+ :arglists_comp "[name & opts+sigs]",
+ :url_friendly_name "defprotocol",
:file "clojure/core_deftype.clj"}],
:examples
[{:namespace_id 99,
@@ -8308,7 +8389,31 @@
:url "http://clojuredocs.org/v/1288"},
"clojure.contrib.str-utils2/butlast"
{:comments [],
- :see-alsos [],
+ :see-alsos
+ [{:namespace_id 99,
+ :weight 2,
+ :name "butlast",
+ :updated_at "2010-11-06 03:20:28.0",
+ :version "1.2.0",
+ :created_at "2010-07-14 20:21:13.0",
+ :added nil,
+ :url "http://clojuredocs.org/v/1658",
+ :line "232",
+ :arglists_comp "[coll]",
+ :url_friendly_name "butlast",
+ :file "clojure/core.clj"}
+ {:namespace_id 88,
+ :weight 0,
+ :name "butlast",
+ :updated_at "2010-10-20 04:41:59.0",
+ :version "1.2.0",
+ :created_at "2010-07-14 20:59:59.0",
+ :added nil,
+ :url "http://clojuredocs.org/v/1319",
+ :line "125",
+ :arglists_comp "[n s]",
+ :url_friendly_name "butlast",
+ :file "clojure/contrib/string.clj"}],
:examples [],
:id 1268,
:name "butlast",
@@ -12169,15 +12274,15 @@
:examples
[{:namespace_id 99,
:ns "clojure.core",
- :updated_at "2012-03-28 09:05:07.0",
+ :updated_at "2012-09-12 12:11:43.0",
:function "empty",
- :version 4,
+ :version 5,
:created_at "2010-07-28 05:20:00.0",
:library "Clojure Core",
:lib_version "1.2.0",
:library_id 3,
:body
- "user=> (empty [1 2 3])\n[]\nuser=> (empty (list 1 2 3))\n()\nuser=> (map #(empty %) [[\\a \\b] {1 2} (range 4)])\n([] {} ())"}],
+ "user=> (empty [1 2 3])\r\n[]\r\nuser=> (empty (list 1 2 3))\r\n()\r\nuser=> (map empty [[\\a \\b] {1 2} (range 4)])\r\n([] {} ())\r\n"}],
:id 5486,
:name "empty",
:ns "clojure.core",
@@ -12739,7 +12844,18 @@
:lib_version "1.3.0",
:library_id 15,
:body
- "(loop [i 0] \n (when (< i 5) \n (println i) \n (recur (inc i)); loop i will take this value\n))"}],
+ "(loop [i 0] \n (when (< i 5) \n (println i) \n (recur (inc i)); loop i will take this value\n))"}
+ {:namespace_id 330,
+ :ns "clojure.core",
+ :updated_at "2012-08-25 17:48:12.0",
+ :function "recur",
+ :version 2,
+ :created_at "2012-08-25 17:44:41.0",
+ :library "Clojure Core",
+ :lib_version "1.3.0",
+ :library_id 15,
+ :body
+ "(defn compute-across [func elements value]\n (if (empty? elements)\n value\n (recur func (rest elements) (func value (first elements)))))\n\n(defn total-of [numbers]\n (compute-across + numbers 0))\n\n(defn larger-of [x y]\n (if (> x y) x y))\n\n(defn greatest-of [numbers]\n (compute-across larger-of numbers (first numbers)))"}],
:id 6130,
:name "recur",
:ns "clojure.core",
@@ -12827,15 +12943,15 @@
:examples
[{:namespace_id 99,
:ns "clojure.core",
- :updated_at "2011-01-03 06:52:48.0",
+ :updated_at "2012-09-10 16:49:31.0",
:function "->>",
- :version 6,
+ :version 7,
:created_at "2010-07-23 23:14:24.0",
:library "Clojure Core",
:lib_version "1.2.0",
:library_id 3,
:body
- ";; get the sum of the first 10 even squares\nuser=> (->> (range)\n (map #(* % %))\n (filter even?)\n (take 10)\n (reduce +))\n1140\n\n;; this expands to:\nuser=> (reduce + (take 10 (filter even? (map #(* % %) (range)))))\n1140\n"}
+ ";; An example of using the \"thread-last\" macro to get\n;; the sum of the first 10 even squares.\nuser=> (->> (range)\n (map #(* % %))\n (filter even?)\n (take 10)\n (reduce +))\n1140\n\n;; This expands to:\nuser=> (reduce +\n (take 10\n (filter even?\n (map #(* % %)\n (range)))))\n1140\n"}
{:namespace_id 330,
:ns "clojure.core",
:updated_at "2012-07-30 08:51:26.0",
@@ -16023,26 +16139,26 @@
:examples
[{:namespace_id 99,
:ns "clojure.core",
- :updated_at "2010-09-26 02:59:48.0",
+ :updated_at "2012-09-05 21:12:50.0",
:function "future",
- :version 3,
+ :version 8,
:created_at "2010-08-05 23:48:51.0",
:library "Clojure Core",
:lib_version "1.2.0",
:library_id 3,
:body
- ";; A future is calculated in another thread\nuser=> (def f (future (Thread/sleep 10000) 100))\n#'user/f\n\n;; When you dereference it you will block until the result is available.\nuser=> @f\n100\n\n;; Dereferencing again will return the already calculated value.\n"}
+ ";; A future's calculation is started here and it runs in another thread\nuser=> (def f (future (Thread/sleep 10000) (println \"done\") 100))\n#'user/f\n;;if you wait 10 seconds before dereferencing it you'll see \"done\"\n\n;; When you dereference it you will block until the result is available.\nuser=> @f\ndone\n100\n\n;; Dereferencing again will return the already calculated value.\n=> @f\n100\n"}
{:namespace_id 99,
:ns "clojure.core",
- :updated_at "2012-05-08 21:10:40.0",
+ :updated_at "2012-09-05 21:12:48.0",
:function "future",
- :version 2,
+ :version 3,
:created_at "2011-08-03 05:43:23.0",
:library "Clojure Core",
:lib_version "1.2.0",
:library_id 3,
:body
- ";; save the example in a script (e.g. test-future.clj) then run it in the console\n;;\n;; > clojure test-future.clj\n\n(println \"[Main] calculate the answer to life the universe and everything\")\n\n;; Used Thread/sleep to simulate long running process\n(def what-is-the-answer-to-life (future \n (do \n (println \"[Future] started computation\")\n (Thread/sleep 3000) ;; running for 3 seconds\n (println \"[Future] completed computation\")\n 42)))\n \n(println \"[Main] created future\")\n\n(Thread/sleep 1000)\n(println \"[Main] do other things while waiting for the answer\")\n(println \"[Main] get the answer\")\n(println \"[Main] the result\" @what-is-the-answer-to-life)\n(shutdown-agents)\n\n\n;; You may get something like this\n;;\n;; [Main] calculate the answer to life the universe and everything\n;; [Future] started computation\n;; [Main] created future\n;; [Main] do other things while waiting for the answer\n;; [Main] get the answer\n;; [Future] completed computation\n;; [Main] the result 42\n\n\n;; Note: If you leave out the call to (shutdown-agents), the program will on\n;; most (all?) OS/JVM combinations \"hang\" for 1 minute before the process exits.\n;; It is simply waiting for background threads, created by the future call, to\n;; be shut down. shutdown-agents will shut them down immediately, or\n;; (System/exit <exit-status>) will exit immediately without waiting for them\n;; to shut down.\n\n;; This wait occurs even if you use futures indirectly through some other Clojure\n;; functions that use them internally, such as pmap or clojure.java.shell/sh\n\n;; http://dev.clojure.org/jira/browse/CLJ-124 is a ticket opened against Clojure,\n;; as this 1-minute wait is not considered desirable behavior."}],
+ ";; save the example in a script (e.g. test-future.clj) then run it in the console\n;;\n;; > clojure test-future.clj\n\n(println \"[Main] calculate the answer to life the universe and everything\")\n\n;; Used Thread/sleep to simulate long running process\n(def what-is-the-answer-to-life (future \n (println \"[Future] started computation\")\n (Thread/sleep 3000) ;; running for 3 seconds\n (println \"[Future] completed computation\")\n 42))\n \n(println \"[Main] created future\")\n\n(Thread/sleep 1000)\n(println \"[Main] do other things while waiting for the answer\")\n(println \"[Main] get the answer\")\n(println \"[Main] the result\" @what-is-the-answer-to-life)\n(shutdown-agents)\n\n\n;; You may get something like this\n;;\n;; [Main] calculate the answer to life the universe and everything\n;; [Future] started computation\n;; [Main] created future\n;; [Main] do other things while waiting for the answer\n;; [Main] get the answer\n;; [Future] completed computation\n;; [Main] the result 42\n\n\n;; Note: If you leave out the call to (shutdown-agents), the program will on\n;; most (all?) OS/JVM combinations \"hang\" for 1 minute before the process exits.\n;; It is simply waiting for background threads, created by the future call, to\n;; be shut down. shutdown-agents will shut them down immediately, or\n;; (System/exit <exit-status>) will exit immediately without waiting for them\n;; to shut down.\n\n;; This wait occurs even if you use futures indirectly through some other Clojure\n;; functions that use them internally, such as pmap or clojure.java.shell/sh\n\n;; http://dev.clojure.org/jira/browse/CLJ-124 is a ticket opened against Clojure,\n;; as this 1-minute wait is not considered desirable behavior."}],
:id 5526,
:name "future",
:ns "clojure.core",
@@ -16755,7 +16871,18 @@
:lib_version "1.3.0",
:library_id 15,
:body
- "(loop [x 10]\n (when (> x 1)\n (println x)\n (recur (- x 2))))"}],
+ "(loop [x 10]\n (when (> x 1)\n (println x)\n (recur (- x 2))))"}
+ {:namespace_id 330,
+ :ns "clojure.core",
+ :updated_at "2012-08-20 02:10:16.0",
+ :function "loop",
+ :version 1,
+ :created_at "2012-08-20 02:10:16.0",
+ :library "Clojure Core",
+ :lib_version "1.3.0",
+ :library_id 15,
+ :body
+ "(defn find-needle [needle haystack]\n ;loop binds initial values once,\n ;then binds values from each recursion call\n (loop [needle needle\n maybe-here haystack\n not-here '()]\n\n (let [needle? (first maybe-here)]\n\n ;test for return or recur\n (if (or (= (str needle?) (str needle))\n (empty? maybe-here))\n\n ;return results\n [needle? maybe-here not-here]\n\n ;recur calls loop with new values\n (recur needle\n (rest maybe-here)\n (concat not-here (list (first maybe-here))))))))\n\nuser=>(find-needle \"|\" \"hay|stack\")\n[\\| (\\| \\s \\t \\a \\c \\k) (\\h \\a \\y)]"}],
:id 5595,
:name "loop",
:ns "clojure.core",
@@ -18728,15 +18855,15 @@
"user=> (group-by count [\"a\" \"as\" \"asd\" \"aa\" \"asdf\" \"qwer\"])\n{1 [\"a\"], 2 [\"as\" \"aa\"], 3 [\"asd\"], 4 [\"asdf\" \"qwer\"]}\n\nuser=> (group-by odd? (range 10))\n{false [0 2 4 6 8], true [1 3 5 7 9]}\n"}
{:namespace_id 99,
:ns "clojure.core",
- :updated_at "2010-09-26 00:29:32.0",
+ :updated_at "2012-09-08 16:36:15.0",
:function "group-by",
- :version 3,
+ :version 4,
:created_at "2010-09-21 04:44:34.0",
:library "Clojure Core",
:lib_version "1.2.0",
:library_id 3,
:body
- ";; group by a primary key\nuser=> (group-by :user_id [{:user_id 1 :uri \"/\"} \n {:user_id 2 :uri \"/foo\"} \n {:user_id 1 :uri \"/account\"}])\n\n{1 [{:user_id 1, :uri \"/\"} {:user_id 1, :uri \"/account\"}], 2 [{:user_id 2, :uri \"/foo\"}]}\n"}],
+ ";; group by a primary key\nuser=> (group-by :user-id [{:user-id 1 :uri \"/\"} \n {:user-id 2 :uri \"/foo\"} \n {:user-id 1 :uri \"/account\"}])\n\n{1 [{:user-id 1, :uri \"/\"} {:user-id 1, :uri \"/account\"}],\n 2 [{:user-id 2, :uri \"/foo\"}]}\n"}],
:id 5541,
:name "group-by",
:ns "clojure.core",
@@ -19553,7 +19680,31 @@
:url "http://clojuredocs.org/v/5946"},
"clojure.core/str"
{:comments [],
- :see-alsos [],
+ :see-alsos
+ [{:namespace_id 99,
+ :weight 2,
+ :name "pr",
+ :updated_at "2011-09-07 03:48:35.0",
+ :version "1.2.0",
+ :created_at "2010-07-14 20:25:19.0",
+ :added nil,
+ :url "http://clojuredocs.org/v/2017",
+ :line "2815",
+ :arglists_comp "[]|[x]|[x & more]",
+ :url_friendly_name "pr",
+ :file "clojure/core.clj"}
+ {:namespace_id 99,
+ :weight 0,
+ :name "prn",
+ :updated_at "2010-10-20 04:42:05.0",
+ :version "1.2.0",
+ :created_at "2010-07-14 20:21:07.0",
+ :added nil,
+ :url "http://clojuredocs.org/v/1650",
+ :line "2848",
+ :arglists_comp "[& more]",
+ :url_friendly_name "prn",
+ :file "clojure/core.clj"}],
:examples
[{:namespace_id 99,
:ns "clojure.core",
@@ -20000,9 +20151,9 @@
:url_friendly_name "pr",
:file "clojure/core.clj"}
{:namespace_id 99,
- :weight 3,
+ :weight 4,
:name "read-string",
- :updated_at "2010-12-01 15:32:37.0",
+ :updated_at "2012-08-20 22:21:54.0",
:version "1.2.0",
:created_at "2010-07-14 20:21:47.0",
:added nil,
@@ -20022,7 +20173,18 @@
:lib_version "1.2.0",
:library_id 3,
:body
- "user=> (def x [1 2 3 4 5])\n#'user/x\nuser=> x\n[1 2 3 4 5]\n\n\n;; Turn that data into a string...\nuser=> (pr-str x)\n\"[1 2 3 4 5]\"\n\n\n;; ...and turn that string back into data!\nuser=> (read-string (pr-str x))\n[1 2 3 4 5]\n"}],
+ "user=> (def x [1 2 3 4 5])\n#'user/x\nuser=> x\n[1 2 3 4 5]\n\n\n;; Turn that data into a string...\nuser=> (pr-str x)\n\"[1 2 3 4 5]\"\n\n\n;; ...and turn that string back into data!\nuser=> (read-string (pr-str x))\n[1 2 3 4 5]\n"}
+ {:namespace_id 330,
+ :ns "clojure.core",
+ :updated_at "2012-09-05 04:18:44.0",
+ :function "pr-str",
+ :version 1,
+ :created_at "2012-09-05 04:18:44.0",
+ :library "Clojure Core",
+ :lib_version "1.3.0",
+ :library_id 15,
+ :body
+ ";; you can think of pr-str as the inverse of read-string\n;; turn string into symbols\nuser=> (read-string \"(a b foo :bar)\")\n(a b foo :bar)\n\n;;turn symbols into a string\nuser=> (pr-str '(a b foo :bar))\n\"(a b foo :bar)\""}],
:id 5665,
:name "pr-str",
:ns "clojure.core",
@@ -20334,26 +20496,26 @@
:examples
[{:namespace_id 99,
:ns "clojure.core",
- :updated_at "2010-09-26 02:57:03.0",
+ :updated_at "2012-09-05 13:32:06.0",
:function "lazy-seq",
- :version 3,
+ :version 4,
:created_at "2010-08-09 02:29:49.0",
:library "Clojure Core",
:lib_version "1.2.0",
:library_id 3,
:body
- ";; The following defines a lazy-seq of all positive numbers. Note that \n;; the lazy-seq allows us to make a recursive call in a safe way because\n;; the call does not happen immediately but instead creates a closure.\n\nuser=> (defn positive-numbers \n\t([] (positive-numbers 1))\n\t([n] (lazy-seq (cons n (positive-numbers (inc n))))))\n#'user/positive-numbers\n\nuser=> (take 5 (positive-numbers))\n(1 2 3 4 5)\n\n"}
+ ";; The following defines a lazy-seq of all positive numbers. Note that \n;; the lazy-seq allows us to make a recursive call in a safe way because\n;; the call does not happen immediately but instead creates a closure.\n\nuser=> (defn positive-numbers \n\t([] (positive-numbers 1))\n\t([n] (cons n (lazy-seq (positive-numbers (inc n))))))\n#'user/positive-numbers\n\nuser=> (take 5 (positive-numbers))\n(1 2 3 4 5)\n\n"}
{:namespace_id 330,
:ns "clojure.core",
- :updated_at "2012-05-05 03:49:26.0",
+ :updated_at "2012-09-05 13:32:50.0",
:function "lazy-seq",
- :version 4,
+ :version 5,
:created_at "2011-11-23 23:55:10.0",
:library "Clojure Core",
:lib_version "1.3.0",
:library_id 15,
:body
- ";; A lazy-seq of Fibonacci numbers (fn = fn-1 + fn-2)\n;; The producer function takes exactly two parameters\n;; (because we need the last 2 elements to produce a new one)\nuser=> (defn fib [a b] (lazy-seq (cons a (fib b (+ b a)))))\n\nuser=> (take 5 (fib 1 1))\n(1 1 2 3 5)"}
+ ";; A lazy-seq of Fibonacci numbers (fn = fn-1 + fn-2)\n;; The producer function takes exactly two parameters\n;; (because we need the last 2 elements to produce a new one)\nuser=> (defn fib [a b] (cons a (lazy-seq (fib b (+ b a)))))\n\nuser=> (take 5 (fib 1 1))\n(1 1 2 3 5)"}
{:namespace_id 330,
:ns "clojure.core",
:updated_at "2012-02-26 15:53:44.0",
@@ -23711,6 +23873,18 @@
:line "3818",
:arglists_comp "[n]",
:url_friendly_name "rand-int",
+ :file "clojure/core.clj"}
+ {:namespace_id 99,
+ :weight 2,
+ :name "constantly",
+ :updated_at "2011-07-16 14:10:42.0",
+ :version "1.2.0",
+ :created_at "2010-07-14 20:23:30.0",
+ :added nil,
+ :url "http://clojuredocs.org/v/1856",
+ :line "1112",
+ :arglists_comp "[x]",
+ :url_friendly_name "constantly",
:file "clojure/core.clj"}],
:examples
[{:namespace_id 99,
@@ -28931,7 +29105,18 @@
:library "Clojure Core",
:lib_version "1.3.0",
:library_id 15,
- :body "user> (bit-and 0x08 0xFF)\n8"}],
+ :body "user> (bit-and 0x08 0xFF)\n8"}
+ {:namespace_id 330,
+ :ns "clojure.core",
+ :updated_at "2012-08-24 10:20:34.0",
+ :function "bit-and",
+ :version 1,
+ :created_at "2012-08-24 10:20:34.0",
+ :library "Clojure Core",
+ :lib_version "1.3.0",
+ :library_id 15,
+ :body
+ "user=> (Integer/toBinaryString 235)\n\"11101011\"\nuser=> (Integer/toBinaryString 199)\n\"11000111\"\nuser=> (bit-and 235 199)\n195\nuser=> (Integer/toBinaryString 195)\n\"11000011\"\n\n;;11101011\n;;&\n;;11000111\n;;=\n;;11000011"}],
:id 5380,
:name "bit-and",
:ns "clojure.core",
@@ -29342,7 +29527,19 @@
:url "http://clojuredocs.org/v/3955"},
"clojure.core/pos?"
{:comments [],
- :see-alsos [],
+ :see-alsos
+ [{:namespace_id 99,
+ :weight 1,
+ :name "neg?",
+ :updated_at "2010-10-20 04:42:06.0",
+ :version "1.2.0",
+ :created_at "2010-07-14 20:21:47.0",
+ :added nil,
+ :url "http://clojuredocs.org/v/1708",
+ :line "997",
+ :arglists_comp "[x]",
+ :url_friendly_name "neg_q",
+ :file "clojure/core.clj"}],
:examples
[{:namespace_id 99,
:ns "clojure.core",
@@ -29823,6 +30020,18 @@
:line "2199",
:arglists_comp "[pred coll]",
:url_friendly_name "drop-while",
+ :file "clojure/core.clj"}
+ {:namespace_id 99,
+ :weight 1,
+ :name "split-with",
+ :updated_at "2010-10-20 04:42:05.0",
+ :version "1.2.0",
+ :created_at "2010-07-14 20:20:43.0",
+ :added nil,
+ :url "http://clojuredocs.org/v/1614",
+ :line "2224",
+ :arglists_comp "[pred coll]",
+ :url_friendly_name "split-with",
:file "clojure/core.clj"}],
:examples
[{:namespace_id 99,
@@ -30577,15 +30786,15 @@
:examples
[{:namespace_id 99,
:ns "clojure.core",
- :updated_at "2011-01-07 02:15:46.0",
+ :updated_at "2012-08-23 15:38:29.0",
:function "into-array",
- :version 2,
+ :version 3,
:created_at "2011-01-07 02:15:23.0",
:library "Clojure Core",
:lib_version "1.2.0",
:library_id 3,
:body
- ";; Java doesn't support heterogeneous arrays\n;; this will result in an IllegalArgumentException\nuser=> (into-array [2 \"4\" \"8\" 5])\n;; Evaluation aborted.\n\nuser=> (into-array (range 4))\n#<Integer[] [Ljava.lang.Integer;@63d6dc46>\n\n;; if you assign a type, you still have to coerce values\nuser=> (into-array Byte/TYPE (range 4))\n;; Evaluation aborted.\n\nuser=> (into-array Byte/TYPE (map byte (range 4)))\n#<byte[] [B@68ffefc9>"}
+ ";; Array's component type is set to (class 2), cannot add Strings.\n;; This will result in an IllegalArgumentException\nuser=> (into-array [2 \"4\" \"8\" 5])\n;; Evaluation aborted.\n\nuser=> (into-array (range 4))\n#<Integer[] [Ljava.lang.Integer;@63d6dc46>\n\n;; if you assign a type, you still have to coerce values\nuser=> (into-array Byte/TYPE (range 4))\n;; Evaluation aborted.\n\nuser=> (into-array Byte/TYPE (map byte (range 4)))\n#<byte[] [B@68ffefc9>"}
{:namespace_id 330,
:ns "clojure.core",
:updated_at "2012-05-25 02:08:35.0",
@@ -30629,9 +30838,9 @@
{:comments [],
:see-alsos
[{:namespace_id 99,
- :weight 3,
+ :weight 4,
:name "read-string",
- :updated_at "2010-12-01 15:32:37.0",
+ :updated_at "2012-08-20 22:21:54.0",
:version "1.2.0",
:created_at "2010-07-14 20:21:47.0",
:added nil,
@@ -35062,7 +35271,19 @@
:url "http://clojuredocs.org/v/6092"},
"clojure.core/neg?"
{:comments [],
- :see-alsos [],
+ :see-alsos
+ [{:namespace_id 99,
+ :weight 1,
+ :name "pos?",
+ :updated_at "2010-10-20 04:42:12.0",
+ :version "1.2.0",
+ :created_at "2010-07-14 20:24:38.0",
+ :added nil,
+ :url "http://clojuredocs.org/v/1955",
+ :line "990",
+ :arglists_comp "[x]",
+ :url_friendly_name "pos_q",
+ :file "clojure/core.clj"}],
:examples
[{:namespace_id 99,
:ns "clojure.core",
@@ -36627,6 +36848,30 @@
:line "5618",
:arglists_comp "[f coll]",
:url_friendly_name "map-indexed",
+ :file "clojure/core.clj"}
+ {:namespace_id 99,
+ :weight 2,
+ :name "pmap",
+ :updated_at "2011-08-13 09:51:59.0",
+ :version "1.2.0",
+ :created_at "2010-07-14 20:24:36.0",
+ :added nil,
+ :url "http://clojuredocs.org/v/1952",
+ :line "5426",
+ :arglists_comp "[f coll]|[f coll & colls]",
+ :url_friendly_name "pmap",
+ :file "clojure/core.clj"}
+ {:namespace_id 99,
+ :weight 1,
+ :name "amap",
+ :updated_at "2010-10-20 04:42:10.0",
+ :version "1.2.0",
+ :created_at "2010-07-14 20:23:39.0",
+ :added nil,
+ :url "http://clojuredocs.org/v/1871",
+ :line "4108",
+ :arglists_comp "[a idx ret expr]",
+ :url_friendly_name "amap",
:file "clojure/core.clj"}],
:examples
[{:namespace_id 99,
@@ -37817,6 +38062,18 @@
:line "444",
:arglists_comp "[protocol atype]",
:url_friendly_name "extends_q",
+ :file "clojure/core_deftype.clj"}
+ {:namespace_id 99,
+ :weight 1,
+ :name "satisfies?",
+ :updated_at "2011-01-12 22:33:45.0",
+ :version "1.2.0",
+ :created_at "2010-07-14 20:26:06.0",
+ :added nil,
+ :url "http://clojuredocs.org/v/2086",
+ :line "457",
+ :arglists_comp "[protocol x]",
+ :url_friendly_name "satisfies_q",
:file "clojure/core_deftype.clj"}],
:examples
[{:namespace_id 99,
@@ -37953,15 +38210,15 @@
:examples
[{:namespace_id 99,
:ns "clojure.core",
- :updated_at "2010-09-26 05:19:44.0",
+ :updated_at "2012-09-10 16:51:35.0",
:function "->",
- :version 4,
+ :version 7,
:created_at "2010-07-12 09:49:07.0",
:library "Clojure Core",
:lib_version "1.2.0",
:library_id 3,
:body
- ";; -> can help make code more readable by removing nesting. It can be\n;; especially useful when using host methods:\n\n;; Difficult to read\nuser=> (first (.split (.replace (.toUpperCase \"a b c d\") \"A\" \"X\") \" \"))\n\"X\"\n\n;; Easier to read\nuser=> (-> \"a b c d\" \n .toUpperCase \n (.replace \"A\" \"X\") \n (.split \" \") \n first)\n\"X\"\n\n;; It can also be useful for pulling values out of deeply-nested data structures:\n\nuser=> (def person \n {:name \"Mark Volkmann\"\n :address {:street \"644 Glen Summit\"\n :city \"St. Charles\"\n :state \"Missouri\"\n :zip 63304}\n :employer {:name \"Object Computing, Inc.\"\n :address {:street \"12140 Woodcrest Executive Drive, Suite 250\"\n :city \"Creve Coeur\"\n :state \"Missouri\"\n :zip 63141}}})\n \nuser=> (-> person :employer :address :city)\n\"Creve Coeur\"\n\n;; same as above, but with more nesting\nuser=> (((person :employer) :address) :city)\n\"Creve Coeur\"\n\n\n;; Note that this operator (along with ->>) is called a 'thrush' operator.\n\n\n\n;; From http://clojure-examples.appspot.com/clojure.core/-%3E"}
+ ";; Use of `->` (the \"thread-first\" macro) can help make code\n;; more readable by removing nesting. It can be especially\n;; useful when using host methods:\n\n;; Arguably a bit cumbersome to read:\nuser=> (first (.split (.replace (.toUpperCase \"a b c d\")\n \"A\"\n \"X\")\n \" \"))\n\"X\"\n\n;; Perhaps easier to read:\nuser=> (-> \"a b c d\" \n .toUpperCase \n (.replace \"A\" \"X\") \n (.split \" \") \n first)\n\"X\"\n\n;; It can also be useful for pulling values out of deeply-nested\n;; data structures:\nuser=> (def person \n {:name \"Mark Volkmann\"\n :address {:street \"644 Glen Summit\"\n :city \"St. Charles\"\n :state \"Missouri\"\n :zip 63304}\n :employer {:name \"Object Computing, Inc.\"\n :address {:street \"12140 Woodcrest Dr.\"\n :city \"Creve Coeur\"\n :state \"Missouri\"\n :zip 63141}}})\n \nuser=> (-> person :employer :address :city)\n\"Creve Coeur\"\n\n;; same as above, but with more nesting\nuser=> (((person :employer) :address) :city)\n\"Creve Coeur\"\n\n;; Note that this operator (along with ->>) has at times been\n;; referred to as a 'thrush' operator.\n\n;; From http://clojure-examples.appspot.com/clojure.core/-%3E\n"}
{:namespace_id 99,
:ns "clojure.core",
:updated_at "2011-01-03 08:13:16.0",
@@ -38154,7 +38411,19 @@
:library_id 3,
:body
"(constantly 1) is often useful when it comes to testing. You can think of it like you would a \"stub\"."}],
- :see-alsos [],
+ :see-alsos
+ [{:namespace_id 99,
+ :weight 2,
+ :name "repeatedly",
+ :updated_at "2010-10-20 04:42:15.0",
+ :version "1.2.0",
+ :created_at "2010-07-14 20:25:55.0",
+ :added nil,
+ :url "http://clojuredocs.org/v/2069",
+ :line "4058",
+ :arglists_comp "[f]|[n f]",
+ :url_friendly_name "repeatedly",
+ :file "clojure/core.clj"}],
:examples
[{:namespace_id 99,
:ns "clojure.core",
@@ -38180,15 +38449,15 @@
";; A really goofy way to find the size of a collection\nuser=> (reduce + (map (constantly 1) [:a :b :c]))\n3"}
{:namespace_id 330,
:ns "clojure.core",
- :updated_at "2012-07-19 11:26:08.0",
+ :updated_at "2012-08-19 02:05:53.0",
:function "constantly",
- :version 1,
+ :version 3,
:created_at "2012-07-19 11:26:08.0",
:library "Clojure Core",
:lib_version "1.3.0",
:library_id 15,
:body
- ";; constantly is a function which always returns a constant\n(map (constantly 9) [1 2 3])\nuser=> (9 9 9)"}],
+ ";; constantly returns a function which always returns the same value\n(map (constantly 9) [1 2 3])\nuser=> (9 9 9)\n\n(map (constantly (rand-int 100)) [:a :b :c])\nuser=> (43 43 43)"}],
:id 5436,
:name "constantly",
:ns "clojure.core",
@@ -39271,7 +39540,31 @@
:url "http://clojuredocs.org/v/2953"},
"clojure.contrib.string/butlast"
{:comments [],
- :see-alsos [],
+ :see-alsos
+ [{:namespace_id 99,
+ :weight 2,
+ :name "butlast",
+ :updated_at "2010-11-06 03:20:28.0",
+ :version "1.2.0",
+ :created_at "2010-07-14 20:21:13.0",
+ :added nil,
+ :url "http://clojuredocs.org/v/1658",
+ :line "232",
+ :arglists_comp "[coll]",
+ :url_friendly_name "butlast",
+ :file "clojure/core.clj"}
+ {:namespace_id 86,
+ :weight 0,
+ :name "butlast",
+ :updated_at "2010-10-20 04:41:58.0",
+ :version "1.2.0",
+ :created_at "2010-07-14 20:59:24.0",
+ :added nil,
+ :url "http://clojuredocs.org/v/1268",
+ :line "131",
+ :arglists_comp "[s n]",
+ :url_friendly_name "butlast",
+ :file "clojure/contrib/str_utils2.clj"}],
:examples [],
:id 1319,
:name "butlast",
@@ -40202,6 +40495,18 @@
:line "2162",
:arglists_comp "[pred coll]",
:url_friendly_name "take-while",
+ :file "clojure/core.clj"}
+ {:namespace_id 99,
+ :weight 1,
+ :name "split-with",
+ :updated_at "2010-10-20 04:42:05.0",
+ :version "1.2.0",
+ :created_at "2010-07-14 20:20:43.0",
+ :added nil,
+ :url "http://clojuredocs.org/v/1614",
+ :line "2224",
+ :arglists_comp "[pred coll]",
+ :url_friendly_name "split-with",
:file "clojure/core.clj"}],
:examples
[{:namespace_id 99,
@@ -42886,7 +43191,18 @@
:arglists_comp "[meth]",
:url_friendly_name "method-sig",
:file "clojure/core_proxy.clj"}],
- :examples [],
+ :examples
+ [{:namespace_id 75,
+ :ns "clojure.contrib.repl-utils",
+ :updated_at "2012-09-07 04:26:44.0",
+ :function "show",
+ :version 1,
+ :created_at "2012-09-07 04:26:44.0",
+ :library "Clojure Contrib",
+ :lib_version "1.2.0",
+ :library_id 1,
+ :body
+ "(show Integer)\n(show [])\n(show String 23)\n(show String \"case\")"}],
:id 335,
:name "show",
:ns "clojure.contrib.repl-utils",
@@ -44086,15 +44402,15 @@
{:comments
[{:namespace_id 330,
:ns "clojure.core",
- :updated_at "2012-08-06 23:23:50.0",
+ :updated_at "2012-08-20 02:16:43.0",
:user_id 691,
:function "val",
:version "1.3.0",
:created_at "2012-08-06 23:23:03.0",
:library "Clojure Core",
:library_id 15,
:body
- "This is my first attempt at using this site to gain an understanding of a closure function. Two of the examples above seem incorrect. \n\nExample 1(?) does not work as shown when I run it in my repl. Instead of getting the list of values, I just the get the entire map of keys and values {:a 1 :b 2}. I had to use the (vals {:a 1 :b 2}) example to get (1 2).\n\nExample 3(?) seems to have nothing to do with val \n\n(notice the lack of example identifiers)\n"}],
+ "This is my first attempt at using this site to gain an understanding of a closure function. Two of the examples above seem incorrect. \n\nExample 3(?) seems to have nothing to do with val \n\n(notice the lack of example identifiers)\n"}],
:see-alsos
[{:namespace_id 99,
:weight 1,
@@ -47067,9 +47383,9 @@
"This function is for reading clojure objects not a general input function."}],
:see-alsos
[{:namespace_id 99,
- :weight 3,
+ :weight 4,
:name "read-string",
- :updated_at "2010-12-01 15:32:37.0",
+ :updated_at "2012-08-20 22:21:54.0",
:version "1.2.0",
:created_at "2010-07-14 20:21:47.0",
:added nil,
@@ -50706,7 +51022,31 @@
:line "169",
:arglists_comp "[s re]|[s re limit]",
:url_friendly_name "split",
- :file "clojure/string.clj"}],
+ :file "clojure/string.clj"}
+ {:namespace_id 99,
+ :weight 1,
+ :name "take-while",
+ :updated_at "2010-10-20 04:42:12.0",
+ :version "1.2.0",
+ :created_at "2010-07-14 20:24:40.0",
+ :added nil,
+ :url "http://clojuredocs.org/v/1958",
+ :line "2162",
+ :arglists_comp "[pred coll]",
+ :url_friendly_name "take-while",
+ :file "clojure/core.clj"}
+ {:namespace_id 99,
+ :weight 1,
+ :name "drop-while",
+ :updated_at "2010-10-20 04:42:15.0",
+ :version "1.2.0",
+ :created_at "2010-07-14 20:26:00.0",
+ :added nil,
+ :url "http://clojuredocs.org/v/2075",
+ :line "2199",
+ :arglists_comp "[pred coll]",
+ :url_friendly_name "drop-while",
+ :file "clojure/core.clj"}],
:examples
[{:namespace_id 99,
:ns "clojure.core",

0 comments on commit 8d91828

Please sign in to comment.