Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update latest ClojureDocs.org snapshot to June 6, 2012

  • Loading branch information...
commit 65313a6938de661eedf9db9bebe9e2b96037c708 1 parent 15360aa
@jafingerhut authored
Showing with 200 additions and 31 deletions.
  1. +200 −31 snapshots/clojuredocs-snapshot-latest.txt
View
231 snapshots/clojuredocs-snapshot-latest.txt
@@ -1,4 +1,4 @@
-{:snapshot-time "Thu May 24 23:05:45 PDT 2012",
+{:snapshot-time "Wed Jun 06 17:31:16 PDT 2012",
:snapshot-info
{"clojure.zip/insert-right"
{:comments [],
@@ -940,7 +940,18 @@
:ns "clojure.contrib.test-is",
:url "http://clojuredocs.org/v/1370"},
"clojure.core/partition-by"
- {:comments [],
+ {:comments
+ [{:namespace_id 330,
+ :ns "clojure.core",
+ :updated_at "2012-06-03 22:10:17.0",
+ :user_id 620,
+ :function "partition-by",
+ :version "1.3.0",
+ :created_at "2012-06-03 21:08:34.0",
+ :library "Clojure Core",
+ :library_id 15,
+ :body
+ "It's worth mentioning that `(partition-by identity …)` is equivalent to the `Data.List.group` function in Haskell:\n\n<pre> \n(defn group [coll]\n (partition-by identity coll))\n</pre>\n\nWhich proves to be an interesting idiom:\n\n<pre>user=&gt; (apply str \n (for [ch (group \"fffffffuuuuuuuuuuuu\")] \n (str (first ch) (count ch))))\n⇒ \"f7u12\"\n</pre>"}],
:see-alsos
[{:namespace_id 99,
:weight 1,
@@ -3172,15 +3183,15 @@
";; 'merge-with' works with an arbitrary number of maps:\n\nuser=> (merge-with + \n {:a 1 :b 2}\n {:a 9 :b 98 :c 0}\n {:a 10 :b 100 :c 10}\n {:a 5}\n {:c 5 :d 42})\n \n{:d 42, :c 15, :a 25, :b 200}"}
{:namespace_id 330,
:ns "clojure.core",
- :updated_at "2012-01-06 12:35:51.0",
+ :updated_at "2012-06-03 22:25:19.0",
:function "merge-with",
- :version 1,
+ :version 2,
:created_at "2012-01-06 12:35:51.0",
:library "Clojure Core",
:lib_version "1.3.0",
:library_id 15,
:body
- ";; Use union to merge sets of elements\nuser=> (use 'clojure.set)\nuser=> (merge-with union\n {:a #{1 2 3}, \n :b #{4 5 6}}\n {:a #{2 3 7 8},\n :c #{1 2 3}})\n\n{:c #{1 2 3}, :a #{1 2 3 7 8}, :b #{4 5 6}}"}],
+ ";; Use union to merge sets of elements\nuser=> (use 'clojure.set)\nuser=> (merge-with union\n {:a #{1 2 3}, :b #{4 5 6}}\n {:a #{2 3 7 8}, :c #{1 2 3}})\n\n{:c #{1 2 3}, :a #{1 2 3 7 8}, :b #{4 5 6}}"}],
:id 5609,
:name "merge-with",
:ns "clojure.core",
@@ -3390,15 +3401,15 @@
";; Imports only the split function from clojure.string.\nuser=> (use '[clojure.string :only (split)])\nnil\n\n;; split is now available without a namespace qualification.\nuser=> (split \"hello world\" #\" \")\n[\"hello\" \"world\"]\n\n;; You can also add the :as keyword to import the rest of clojure.string\n;; with a namespace qualification.\nuser=> (use '[clojure.string :as s :only (split)])\nnil\n\n;; Now we can access any function in clojure.string using s.\nuser=> (s/replace \"foobar\" \"foo\" \"squirrel\")\n\"squirrelbar\"\n\n;; And we can still call split with or without the s qualification.\nuser=> (split \"hello world\" #\" \")\n[\"hello\" \"world\"]\nuser=> (s/split \"hello world\" #\" \")\n[\"hello\" \"world\"]"}
{:namespace_id 99,
:ns "clojure.core",
- :updated_at "2010-11-29 01:07:00.0",
+ :updated_at "2012-05-30 17:40:18.0",
:function "use",
- :version 1,
+ :version 2,
:created_at "2010-11-29 01:07:00.0",
:library "Clojure Core",
:lib_version "1.2.0",
:library_id 3,
:body
- "(ns some.namespace\n (:require [clojure.contrib.json :as json])\n (:use [clojure.string :only [trim lower-case split]])\n (:use clojure.contrib.shell-out)\n (:use clojure.pprint)\n (:use clojure.test))"}],
+ "(ns some.namespace\n (:require [clojure.contrib.json :as json])\n (:use [clojure.string :only [trim lower-case split]]\n [clojure.contrib.shell-out]\n [clojure.pprint]\n [clojure.test]))\n"}],
:id 5825,
:name "use",
:ns "clojure.core",
@@ -3530,8 +3541,43 @@
:url "http://clojuredocs.org/v/5142"},
"clojure.set/superset?"
{:comments [],
- :see-alsos [],
- :examples [],
+ :see-alsos
+ [{:namespace_id 111,
+ :weight 1,
+ :name "subset?",
+ :updated_at "2010-12-29 18:04:21.0",
+ :version "1.2.0",
+ :created_at "2010-07-14 20:27:40.0",
+ :added nil,
+ :url "http://clojuredocs.org/v/2456",
+ :line "142",
+ :arglists_comp "[set1 set2]",
+ :url_friendly_name "subset_q",
+ :file "clojure/set.clj"}
+ {:namespace_id 99,
+ :weight 2,
+ :name "set",
+ :updated_at "2010-11-15 00:53:25.0",
+ :version "1.2.0",
+ :created_at "2010-07-14 20:23:24.0",
+ :added nil,
+ :url "http://clojuredocs.org/v/1848",
+ :line "3163",
+ :arglists_comp "[coll]",
+ :url_friendly_name "set",
+ :file "clojure/core.clj"}],
+ :examples
+ [{:namespace_id 343,
+ :ns "clojure.set",
+ :updated_at "2012-05-26 13:37:27.0",
+ :function "superset?",
+ :version 1,
+ :created_at "2012-05-26 13:37:27.0",
+ :library "Clojure Core",
+ :lib_version "1.3.0",
+ :library_id 15,
+ :body
+ "(use '[clojure.set :only [superset?]])\n\nuser=> (superset? #{0} #{0})\ntrue\n\nuser=> (superset? #{0 1} #{0})\ntrue\n\nuser=> (superset? #{0} #{0 1}) \nfalse\n"}],
:id 5989,
:name "superset?",
:ns "clojure.set",
@@ -5988,6 +6034,18 @@
:line "2384",
:arglists_comp "[seq-exprs & body]",
:url_friendly_name "doseq",
+ :file "clojure/core.clj"}
+ {:namespace_id 99,
+ :weight 1,
+ :name "doall",
+ :updated_at "2010-10-20 04:42:08.0",
+ :version "1.2.0",
+ :created_at "2010-07-14 20:22:55.0",
+ :added nil,
+ :url "http://clojuredocs.org/v/1806",
+ :line "2456",
+ :arglists_comp "[coll]|[n coll]",
+ :url_friendly_name "doall",
:file "clojure/core.clj"}],
:examples
[{:namespace_id 99,
@@ -6054,7 +6112,18 @@
:lib_version "1.2.0",
:library_id 3,
:body
- "user=> (for [[x y] '([:a 1] [:b 2] [:c 0]) :when (= y 0)] x)\n(:c)\n"}],
+ "user=> (for [[x y] '([:a 1] [:b 2] [:c 0]) :when (= y 0)] x)\n(:c)\n"}
+ {:namespace_id 330,
+ :ns "clojure.core",
+ :updated_at "2012-05-29 10:40:41.0",
+ :function "for",
+ :version 1,
+ :created_at "2012-05-29 10:40:41.0",
+ :library "Clojure Core",
+ :lib_version "1.3.0",
+ :library_id 15,
+ :body
+ "; Demonstrating difference between :when and :while\n\nuser=> (time (dorun (for [x (range 1000) y (range 10000) :when (> x y)] [x y])))\n\"Elapsed time: 2898.908 msecs\"\nnil\n\nuser=> (time (dorun (for [x (range 1000) y (range 10000) :while (> x y)] [x y])))\n\"Elapsed time: 293.677 msecs\"\nnil"}],
:id 5522,
:name "for",
:ns "clojure.core",
@@ -9505,7 +9574,18 @@
:arglists_comp "",
:url_friendly_name "iofactory",
:file "clojure/java/io.clj"}],
- :examples [],
+ :examples
+ [{:namespace_id 336,
+ :ns "clojure.java.io",
+ :updated_at "2012-05-28 23:42:22.0",
+ :function "output-stream",
+ :version 2,
+ :created_at "2012-05-28 23:30:14.0",
+ :library "Clojure Core",
+ :lib_version "1.3.0",
+ :library_id 15,
+ :body
+ "(:use [clojure.java.io :only [output-stream]])\n\n(defn use-output-stream []\n (with-open [o (output-stream \"test.txt\")]\n (.write o 65))) ; Writes 'A'"}],
:id 5893,
:name "output-stream",
:ns "clojure.java.io",
@@ -10570,7 +10650,19 @@
:line "3163",
:arglists_comp "[coll]",
:url_friendly_name "set",
- :file "clojure/core.clj"}],
+ :file "clojure/core.clj"}
+ {:namespace_id 111,
+ :weight 0,
+ :name "superset?",
+ :updated_at "2010-10-20 04:42:18.0",
+ :version "1.2.0",
+ :created_at "2010-07-14 20:27:37.0",
+ :added nil,
+ :url "http://clojuredocs.org/v/2454",
+ :line "150",
+ :arglists_comp "[set1 set2]",
+ :url_friendly_name "superset_q",
+ :file "clojure/set.clj"}],
:examples
[{:namespace_id 111,
:ns "clojure.set",
@@ -10914,7 +11006,18 @@
:library "Clojure Core",
:library_id 3,
:body
- "Hi, cocoOS. You may want to do it like this:\n\n<pre>user=&gt; (use '[clojure.string :only (split)])\nnil\nuser=&gt; (def bignumber \"2938434\")\n#'user/bignumber\nuser=&gt; (split bignumber #\"\")\n[\"\" \"2\" \"9\" \"3\" \"8\" \"4\" \"3\" \"4\"]\n</pre>\n\nYou will have to filter out the empty string.\n\n<br>\n\nBut there are other ways, like:\n<pre>user=&gt; (map str (vec bignumber))\n(\"2\" \"9\" \"3\" \"8\" \"4\" \"3\" \"4\")\n</pre>"}],
+ "Hi, cocoOS. You may want to do it like this:\n\n<pre>user=&gt; (use '[clojure.string :only (split)])\nnil\nuser=&gt; (def bignumber \"2938434\")\n#'user/bignumber\nuser=&gt; (split bignumber #\"\")\n[\"\" \"2\" \"9\" \"3\" \"8\" \"4\" \"3\" \"4\"]\n</pre>\n\nYou will have to filter out the empty string.\n\n<br>\n\nBut there are other ways, like:\n<pre>user=&gt; (map str (vec bignumber))\n(\"2\" \"9\" \"3\" \"8\" \"4\" \"3\" \"4\")\n</pre>"}
+ {:namespace_id 113,
+ :ns "clojure.string",
+ :updated_at "2012-06-03 22:05:57.0",
+ :user_id 620,
+ :function "split",
+ :version "1.2.0",
+ :created_at "2012-06-03 22:05:57.0",
+ :library "Clojure Core",
+ :library_id 3,
+ :body
+ "<pre>\nuser=> (seq \"2938434\")\n(\\2 \\9 \\3 \\8 \\4 \\3 \\4)\n</pre>\n\nmight also be what you want."}],
:see-alsos
[{:namespace_id 99,
:weight 1,
@@ -11680,15 +11783,15 @@
:examples
[{:namespace_id 99,
:ns "clojure.core",
- :updated_at "2011-10-04 08:25:48.0",
+ :updated_at "2012-06-03 21:35:27.0",
:function "interpose",
- :version 2,
+ :version 5,
:created_at "2010-07-03 09:32:31.0",
:library "Clojure Core",
:lib_version "1.2.0",
:library_id 3,
:body
- ";; The quintessential interpose example:\n\nuser> (def my-strings [\"one\" \"two\" \"three\"])\n\nuser> (interpose \", \" my-strings)\n=> (\"one\" \", \" \"two\" \", \" \"three\")\n\nuser> (apply str (interpose \", \" my-strings))\n=> \"one, two, three\"\n"}],
+ ";; The quintessential interpose example:\nuser> (def my-strings [\"one\" \"two\" \"three\"])\n\nuser> (interpose \", \" my-strings)\n=> (\"one\" \", \" \"two\" \", \" \"three\")\n\nuser> (apply str (interpose \", \" my-strings))\n=> \"one, two, three\"\n\n;; Might use clojure.string/join if the plan is to join\n(use '[clojure.string :only (join)])\nuser> (join \", \" my-strings)\n=> \"one, two, three\""}],
:id 5562,
:name "interpose",
:ns "clojure.core",
@@ -13062,7 +13165,18 @@
:lib_version "1.3.0",
:library_id 15,
:body
- ";; See examples for \"if\" explaining Clojure's idea of logical true\n;; and logical false."}],
+ ";; See examples for \"if\" explaining Clojure's idea of logical true\n;; and logical false."}
+ {:namespace_id 330,
+ :ns "clojure.core",
+ :updated_at "2012-05-28 23:35:35.0",
+ :function "cond",
+ :version 1,
+ :created_at "2012-05-28 23:35:35.0",
+ :library "Clojure Core",
+ :lib_version "1.3.0",
+ :library_id 15,
+ :body
+ ";; Generates a random number compares it to user input\n(let [rnd (rand-int 10)\n guess (Integer/parseInt (read-line))]\n (cond\n (= rnd guess) (println \"You got my guess right!\")\n :else (println \"Sorry... guess again!\")))"}],
:id 5431,
:name "cond",
:ns "clojure.core",
@@ -16674,7 +16788,18 @@
"ring.middleware.flash/wrap-flash"
{:comments [],
:see-alsos [],
- :examples [],
+ :examples
+ [{:namespace_id 127,
+ :ns "ring.middleware.flash",
+ :updated_at "2012-05-30 00:05:35.0",
+ :function "wrap-flash",
+ :version 2,
+ :created_at "2012-05-29 23:55:25.0",
+ :library "ring",
+ :lib_version "0.2.3",
+ :library_id 4,
+ :body
+ "(use 'ring.middleware.flash\n 'ring.middleware.params\n 'ring.middleware.session\n 'ring.util.response\n 'ring.adapter.jetty)\n\n(defn save\n [request]\n (let [value (-> request :params :value)]\n ;; somehow save value\n ;; the :flash key on the response will be placed in the :session by wrap-flash\n (assoc (redirect \"/\") :flash \"Value is saved\")))\n\n(defn home\n [request]\n (let [uri (-> request :uri)]\n (if (.startsWith uri \"/save\")\n (save request)\n ;; before calling the home fn wrap-flash will move the :flash message from the :session to the request\n (if-let [flash-message (-> request :flash)]\n (response (str \"Flash message found: \" flash-message))\n (response \"No flash message found\")))))\n\n(def app (-> home wrap-flash wrap-session wrap-params))\n\n(run-jetty app {:port 3000})\n\n;; go to http://localhost:3000 and http://localhost:3000/save"}],
:id 2669,
:name "wrap-flash",
:ns "ring.middleware.flash",
@@ -23885,26 +24010,26 @@
:examples
[{:namespace_id 99,
:ns "clojure.core",
- :updated_at "2010-09-26 03:27:20.0",
+ :updated_at "2012-06-06 00:41:55.0",
:function "replace",
- :version 3,
+ :version 5,
:created_at "2010-07-27 20:54:00.0",
:library "Clojure Core",
:lib_version "1.2.0",
:library_id 3,
:body
- "user=> (replace ['a 'b 'c 'd 'e] [0 2 4])\n[a c e]\n\nuser=> (replace [10 9 8 7 6] [0 2 4])\n[10 8 6]\n\nuser=> (replace {0 'zero 1 'one 2 'two} '(0 1 2 0))\n(zero one two zero)\n"}
+ "user=> (replace [:zeroth :first :second :third :fourth] [0 2 4 0])\n[:zeroth :second :fourth :zeroth]\n\nuser=> (replace [10 9 8 7 6] [0 2 4])\n[10 8 6]"}
{:namespace_id 99,
:ns "clojure.core",
- :updated_at "2011-05-10 18:46:07.0",
+ :updated_at "2012-06-06 00:42:31.0",
:function "replace",
- :version 1,
+ :version 2,
:created_at "2011-05-10 18:46:07.0",
:library "Clojure Core",
:lib_version "1.2.0",
:library_id 3,
:body
- "user=> (replace {2 :a, 4 :b} [4 2 3 4 5 6 2])\n[:b :a 3 :b 5 6 :a]"}],
+ "user=> (replace '{0 ZERO, 1 ONE, 2 TWO} '(This is the code — 0 1 2 0))\n(This is the code — ZERO ONE TWO ZERO)\n\nuser=> (replace {2 :two, 4 :four} [4 2 3 4 5 6 2])\n[:four :two 3 :four 5 6 :two]\n"}],
:id 5725,
:name "replace",
:ns "clojure.core",
@@ -26661,7 +26786,17 @@
"clojure.core/nthrest"
{:comments [],
:see-alsos [],
- :examples [],
+ :examples
+ [{:namespace_id 330,
+ :ns "clojure.core",
+ :updated_at "2012-06-04 06:36:54.0",
+ :function "nthrest",
+ :version 1,
+ :created_at "2012-06-04 06:36:54.0",
+ :library "Clojure Core",
+ :lib_version "1.3.0",
+ :library_id 15,
+ :body "user=> (nthrest (range 10) 5)\n(5 6 7 8 9)"}],
:id 5644,
:name "nthrest",
:ns "clojure.core",
@@ -28441,15 +28576,15 @@
";; Calculate the sum of all numbers under 1000:\nuser=> (reduce + (take-while (partial > 1000 ) (iterate inc 0)))\n499500"}
{:namespace_id 330,
:ns "clojure.core",
- :updated_at "2011-11-18 01:07:38.0",
+ :updated_at "2012-06-03 22:01:04.0",
:function "take-while",
- :version 3,
+ :version 4,
:created_at "2011-11-18 01:06:24.0",
:library "Clojure Core",
:lib_version "1.3.0",
:library_id 15,
:body
- "user=> (take-while neg? [-2 -1 0 1 2 3])\n(-2 -1)\n\nuser=> (take-while neg? [ 0 1 2 3])\n()\n\nuser=> (take-while neg? [])\n()\n\nuser=> (take-while neg? nil)\n()"}],
+ "user=> (take-while neg? [-2 -1 0 1 2 3])\n(-2 -1)\n\nuser=> (take-while neg? [-2 -1 0 -1 -2 3])\n(-2 -1)\n\nuser=> (take-while neg? [ 0 1 2 3])\n()\n\nuser=> (take-while neg? [])\n()\n\nuser=> (take-while neg? nil)\n()"}],
:id 5787,
:name "take-while",
:ns "clojure.core",
@@ -30076,7 +30211,18 @@
:library "Clojure Core",
:lib_version "1.2.0",
:library_id 3,
- :body ";when working with lazy seqs\n(time (doall (...)))"}],
+ :body ";when working with lazy seqs\n(time (doall (...)))"}
+ {:namespace_id 330,
+ :ns "clojure.core",
+ :updated_at "2012-05-28 23:43:32.0",
+ :function "time",
+ :version 2,
+ :created_at "2012-05-28 23:39:43.0",
+ :library "Clojure Core",
+ :lib_version "1.3.0",
+ :library_id 15,
+ :body
+ ";; Time how long it takes to write a string to a file 100 times\n(defn time-test []\n (with-open [w (writer \"test.txt\" :append false)]\n (dotimes [_ 100]\n (.write w \"I am being written to a file.\"))))\n\n\nuser=> (time (time-test))\n\"Elapsed time: 19.596371 msecs\""}],
:id 5791,
:name "time",
:ns "clojure.core",
@@ -33247,6 +33393,18 @@
:line "2230",
:arglists_comp "[x]|[n x]",
:url_friendly_name "repeat",
+ :file "clojure/core.clj"}
+ {:namespace_id 99,
+ :weight 6,
+ :name "for",
+ :updated_at "2011-05-10 18:07:55.0",
+ :version "1.2.0",
+ :created_at "2010-07-14 20:19:53.0",
+ :added nil,
+ :url "http://clojuredocs.org/v/1548",
+ :line "3582",
+ :arglists_comp "[seq-exprs body-expr]",
+ :url_friendly_name "for",
:file "clojure/core.clj"}],
:examples
[{:namespace_id 99,
@@ -37819,7 +37977,18 @@
"net.cgrand.enlive-html/defsnippet"
{:comments [],
:see-alsos [],
- :examples [],
+ :examples
+ [{:namespace_id 198,
+ :ns "net.cgrand.enlive-html",
+ :updated_at "2012-05-28 20:05:24.0",
+ :function "defsnippet",
+ :version 3,
+ :created_at "2012-05-28 17:45:52.0",
+ :library "enlive",
+ :lib_version "1.0.0-SNAPSHOT",
+ :library_id 8,
+ :body
+ ";; snippet1.html\n;; <h1>Welcome <span id=\"name\">Rich</span></h1>\n\n(defsnippet snippet1\n \"snippet1.html\"\n [[:h1]]\n [name]\n [:#name] (content name))\n\n;; template1.html\n;; <html><body><div id=\"snippetinsert\"/></body></html>\n(deftemplate template1\n \"template1.html\"\n [name]\n [:#snippetinsert] (content (snippet1 name)))\n\n(template1 \"Steven\")"}],
:id 3881,
:name "defsnippet",
:ns "net.cgrand.enlive-html",

0 comments on commit 65313a6

Please sign in to comment.
Something went wrong with that request. Please try again.