Liking cljdoc? Tell your friends :D

tornado.util

Utility functions used internally in Tornado.

Utility functions used internally in Tornado.
raw docstring

->fixedclj/s

(->fixed x)
(->fixed x d)

Rounds a given number x to d decimal digits, or 0 by default.

Rounds a given number x to d decimal digits, or 0 by default.
sourceraw docstring

apply-avgclj/s

(apply-avg coll)

Same as (apply average coll)

Same as (apply average coll)
sourceraw docstring

averageclj/s

(average & args)

Computes the average of 1 or more numbers. Accepts elements directly, use apply-avg for a sequence..

Computes the average of 1 or more numbers. Accepts elements directly,
use apply-avg for a sequence..
sourceraw docstring

base10->double-hex-mapclj/s

source

base16-charsclj/s

source

betweenclj/s

(between value n1 n2)

Returns true if value is smaller than or equal n1 and greater than or equal n2.

Returns true if value is smaller than or equal n1 and greater than or equal n2.
sourceraw docstring

c->intclj/s

(c->int x)
source

cartesian-productclj/smacro

(cartesian-product & seqs)

Given any number of seqs, this function returns a lazy sequence of all possible combinations of taking 1 element from each of the input sequences.

Given any number of seqs, this function returns a lazy sequence of all possible
combinations of taking 1 element from each of the input sequences.
sourceraw docstring

conjvclj/s

(conjv vect value)

Equal to (conj (vec vect) value).

Equal to (conj (vec vect) value).
sourceraw docstring

double-hex->base10-mapclj/s

A precalculated map for very fast conversions of hexadecimal strings in format "xx" to base10 numbers.

A precalculated map for very fast conversions of hexadecimal strings in format "xx"
to base10 numbers.
sourceraw docstring

double-hex?clj/s

(double-hex? str-expr)

Returns true if every 2-characters substring of the given string expression matches to the hexadecimal characters.

Returns true if every 2-characters substring of the given string expression
matches to the hexadecimal characters.
sourceraw docstring

exceptionclj/s

(exception arg)
source

get-str-formclj/s

(get-str-form x)

If the argument is a symbol, a keyword or a string, returns its string form. Otherwise, returns nil.

If the argument is a symbol, a keyword or a string, returns its string form.
Otherwise, returns nil.
sourceraw docstring

in-rangeclj/s

(in-range val min-val max-val)

If the value is not in range of min-val and max-val, returns the value of the corresponding border which is nearer to the value, otherwise returns the value.

If the value is not in range of min-val and max-val, returns the value of the
corresponding border which is nearer to the value, otherwise returns the value.
sourceraw docstring

int*clj/s

(int* x)

Converts a float to an integer if the value would remain equal. Ratios will be converted to a float, or, again, to an integer if possible.

Converts a float to an integer if the value would remain equal. Ratios will
be converted to a float, or, again, to an integer if possible.
sourceraw docstring

lowercase-uppercase-differenceclj/s

source

math-powclj/s

(math-pow x y)
source

math-roundclj/s

(math-round x)
source

parse-floatclj/s

(parse-float s)
source

percent->numberclj/s

(percent->number value)
(percent->number value throw-if-no-match)

If the argument is a value in percent, convert it to a corresponding numeral value. Throws an exception if the optional 2nd argument has a truthy value and the input type is none of string, number or CSSUnit instance. Otherwise thís function does not do anything and will return the input.

(percent->int 0.5) => 0.5

(percent->int "75%") ; can be "75 %" as well => 0.75

(percent->int (tornado.units/percent 35)) => 0.35

If the argument is a value in percent, convert it to a corresponding numeral value.
Throws an exception if the optional 2nd argument has a truthy value and the input
type is none of string, number or CSSUnit instance. Otherwise thís function does not
do anything and will return the input.

(percent->int 0.5)
=> 0.5

(percent->int "75%")   ; can be "75 %" as well
=> 0.75

(percent->int (tornado.units/percent 35))
=> 0.35
sourceraw docstring

percent-with-symbol-appendclj/s

(percent-with-symbol-append value)

Multiplies a number with 100 to get a percentage value of it. Returns a string form of it with "%" appended. Non-numbers are returned unaffected.

Multiplies a number with 100 to get a percentage value of it. Returns
a string form of it with "%" appended. Non-numbers are returned unaffected.
sourceraw docstring

prune-nilsclj/s

(prune-nils m)

Given a map, removes all keys having nil value. If the pruned map is empty, returns nil.

Given a map, removes all keys having nil value. If the pruned map is empty, returns nil.
sourceraw docstring

roundclj/s

(round x)

Rounds a given number to 4 decimal digits, which should be enough in most cases.

Rounds a given number to 4 decimal digits, which should be enough in most cases.
sourceraw docstring

some-instance?clj/s

(some-instance? expr & instances)

Returns true if the expression is an instance of any of the instances.

Returns true if the expression is an instance of any of the instances.
sourceraw docstring

str-butlastclj/s

(str-butlast s)

Returns the given string without the last character.

Returns the given string without the last character.
sourceraw docstring

str-colonjoinclj/s

(str-colonjoin coll)

str/join with ": "

str/join with ": "
sourceraw docstring

str-commajoinclj/s

(str-commajoin coll)

str/join with ", "

str/join with ", "
sourceraw docstring

str-spacejoinclj/s

(str-spacejoin coll)

str/join with " "

str/join with " "
sourceraw docstring

to-percent-floatclj/s

(to-percent-float value)

Parses a percentage from a string or multiplies a number with 100 to get a percentage value of it: (tpf "12%") => 12 (tpf "3") => 300 (tpf 8) => 800

Parses a percentage from a string or multiplies a number with 100 to get
a percentage value of it:
(tpf "12%") => 12
(tpf "3") => 300
(tpf 8) => 800
sourceraw docstring

toLowerclj/s

(toLower c)

Characters [A-F] will be transformed to [a-f], other chars will be returned unchanged.

Characters [A-F] will be transformed to [a-f], other chars will be returned unchanged.
sourceraw docstring

uppercase-base16-setclj/s

source

valid?clj/s

(valid? x)

Returns true if the argument is a symbol, a keyword or a string.

Returns true if the argument is a symbol, a keyword or a string.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close