Skip to content

Instantly share code, notes, and snippets.

Created August 29, 2011 00:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/1177493 to your computer and use it in GitHub Desktop.
Save anonymous/1177493 to your computer and use it in GitHub Desktop.
<TimMc> (find-doc #"count")
<lazybot> => ------------------------- clojure.contrib.macro-utils/mexpand
([form]) Like clojure.core/macroexpand, but takes into account
symbol macros. ------------------------- clojure.contrib.macro-utils/mexpand-1
([form]) Like clojure.core/macroexpand-1, but takes into account
symbol macros. ------------------------- clojure.contrib.pprint/cl-format
([writer format-in & args]) An implementation of a Common Lisp
compatible format function. cl-format formats its arguments to an
output stream or string based on the format control string given. It
supports sophisticated formatting of structured data. Writer is an
instance of java.io.Writer, true to output to *out* or nil to output
to a string, format-in is the format control string and the remaining
arguments are the data to be formatted. The format control string is
a string to be output with embedded 'format directives' describing
how to format the various arguments passed in. If writer is nil,
cl-format returns the formatted result string. Otherwise, cl-format
returns nil. For example: (let [results [46 38 22]]
(cl-format true "There ~[are~;is~:;are~]~:* ~d result~:p: ~{~d~^, ~}~%"
(count results) results)) Prints to *out*: There are 3 results: 46,
38, 22 Detailed documentation on format control strings is available
in the "Common Lisp the Language, 2nd edition", Chapter 22 (available
online at: http://www.cs.cmu.edu/afs/cs.cmu.edu/project/ai-repository/ai/html/cltl/clm/node200.html#SECTION002633000000000000000)
and in the Common Lisp HyperSpec at http://www.lispworks.com/documentation/HyperSpec/Body/22_c.htm
------------------------- somnium.congomongo/fetch ([collection :where
:only :limit :skip :as :from :one? :count? :sort]) Fetches objects
from a collection. Note that MongoDB always adds the _id and _ns
fields to objects returned from the database. Optional arguments
include :where -> takes a query map :only -> takes an array
of keys to retrieve :as -> what to return, defaults to
:clojure, can also be :json or :mongo :from -> argument type,
same options as above :skip -> number of records to skip
:limit -> number of records to return :one? -> defaults to
false, use fetch-one as a shortcut :count? -> defaults to false,
use fetch-count as a shortcut :sort -> sort the results by a
specific key ------------------------- clojure.core/assoc ([map key
val] [map key val & kvs]) assoc[iate]. When applied to a map,
returns a new map of the same (hashed/sorted) type, that contains
the mapping of key(s) to val(s). When applied to a vector, returns
a new vector that contains val at index. Note - index must be <=
(count vector). ------------------------- clojure.core/assoc! ([coll
key val] [coll key val & kvs]) Alpha - subject to change. When
applied to a transient map, adds mapping of key(s) to val(s). When
applied to a transient vector, sets the val at index. Note - index
must be <= (count vector). Returns coll. -------------------------
clojure.core/count ([coll]) Returns the number of items in the
collection. (count nil) returns 0. Also works on strings, arrays,
and Java Collections and Maps -------------------------
clojure.core/counted? ([coll]) Returns true if coll implements count
in constant time ------------------------- clojure.core/ref-history-count
([ref]) Returns the history count of a ref -------------------------
clojure.core/subvec ([v start] [v start end]) Returns a persistent
vector of the items in vector from start (inclusive) to end
(exclusive). If end is not supplied, defaults to (count vector).
This operation is O(1) and very fast, as the resulting vector shares
structure with the original and no trimming is done.
------------------------- oauth.client/user-approval-uri ([consumer
token] [consumer token callback-uri]) Builds the URI to the Service
Provider where the User will be prompted to approve the Consumer's
access to their account. -------------------------
clojure.contrib.accumulators/empty-counter nil An empty counter
accumulator. Its value is a map that stores for every item the
number of times it was added. -------------------------
clojure.contrib.accumulators/empty-counter-with-total nil An empty
counter-with-total accumulator. It works like the counter
accumulator, except that the total number of items added is stored as
the value of the key :total. nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment