Miscellaneous functions.
Miscellaneous functions.
(byte-signed->unsigned signed-byte)
Inputs: [signed-byte :- s/Int]
Converts a signed byte [-128..127] into an unsigned byte [0..255].
Inputs: [signed-byte :- s/Int] Converts a signed byte [-128..127] into an unsigned byte [0..255].
(byte-unsigned->signed unsigned-int)
Inputs: [unsigned-int :- s/Int]
Converts an unsigned int value [0..255] into a signed byte [-128..127].
Inputs: [unsigned-int :- s/Int] Converts an unsigned int value [0..255] into a signed byte [-128..127].
(bytes-signed->hex-str signed-bytes)
Inputs: [signed-bytes :- [s/Int]] Returns: s/Str
Converts a sequence of signed bytes [-128..127] to a hex string, where each byte becomes 2 hex digits.
Inputs: [signed-bytes :- [s/Int]] Returns: s/Str Converts a sequence of signed bytes [-128..127] to a hex string, where each byte becomes 2 hex digits.
(bytes-signed->unsigned byte-vals)
Inputs: [byte-vals]
Converts a vector of signed byte values [-128..127] into one of unsigned byte values [0..255]
Inputs: [byte-vals] Converts a vector of signed byte values [-128..127] into one of unsigned byte values [0..255]
(bytes-unsigned->hex-str unsigned-bytes)
Inputs: [unsigned-bytes :- [s/Int]] Returns: s/Str
Converts a sequence of unsigned bytes [0..255] to a hex string, where each byte becomes 2 hex digits.
Inputs: [unsigned-bytes :- [s/Int]] Returns: s/Str Converts a sequence of unsigned bytes [0..255] to a hex string, where each byte becomes 2 hex digits.
(bytes-unsigned->signed byte-vals)
Inputs: [byte-vals]
Converts a vector of unsigned byte values [0..255] into one of signed byte values [-128..127]
Inputs: [byte-vals] Converts a vector of unsigned byte values [0..255] into one of signed byte values [-128..127]
(dot)
Prints a single dot (flushed) to the console, keeping a running count of dots printed. Wraps to a newline when 100 dots have been printed. Displays the running dot count at the beginning of each line. Usage:
(ns xxx.core (:require [tupelo.misc :as tm])) (tm/dots-config! {:decimation 10} ) (tm/with-dots (doseq [ii (range 2345)] (tm/dot) (Thread/sleep 5)))
Prints a single dot (flushed) to the console, keeping a running count of dots printed. Wraps to a newline when 100 dots have been printed. Displays the running dot count at the beginning of each line. Usage: (ns xxx.core (:require [tupelo.misc :as tm])) (tm/dots-config! {:decimation 10} ) (tm/with-dots (doseq [ii (range 2345)] (tm/dot) (Thread/sleep 5)))
(factorial n)
Inputs: [n :- s/Int] Returns: s/Int
Computes the factorial of N
Inputs: [n :- s/Int] Returns: s/Int Computes the factorial of N
(find-pattern pattern-vec data-vec)
Inputs: [pattern-vec :- tsk/List data-vec :- tsk/List] Returns: [s/Int]
Searches for pattern-vec within data-vec, returning a lazy seq of indexes into data-vec.
Inputs: [pattern-vec :- tsk/List data-vec :- tsk/List] Returns: [s/Int] Searches for pattern-vec within data-vec, returning a lazy seq of indexes into data-vec.
(get-path path-str)
Wrapper for Java Paths/get to work around the varargs strangeness
Wrapper for Java Paths/get to work around the varargs strangeness
(hex-str->signed-bytes hex-str)
Inputs: [hex-str :- s/Str]
Converts a hex string to a vector of unsigned bytes
Inputs: [hex-str :- s/Str] Converts a hex string to a vector of unsigned bytes
(hex-str->unsigned-bytes hex-str)
Inputs: [hex-str :- s/Str]
Converts a hex string to a vector of unsigned bytes
Inputs: [hex-str :- s/Str] Converts a hex string to a vector of unsigned bytes
(hid->wid hid)
Inputs: [hid :- HID] Returns: s/Keyword
Uses an HID to look up a human-friendly Word-ID (WID) from an English dictionary. Useful for debugging purposes.
Inputs: [hid :- HID] Returns: s/Keyword Uses an HID to look up a human-friendly Word-ID (WID) from an English dictionary. Useful for debugging purposes.
(hid? arg)
Inputs: [arg] Returns: s/Bool
Returns true if the arg is a legal HexID
Inputs: [arg] Returns: s/Bool Returns true if the arg is a legal HexID
(new-hid)
Inputs: [] Returns: HID
Returns a new HexID
Inputs: [] Returns: HID Returns a new HexID
(sha-uuid)
Inputs: [] Returns: s/Str
Returns a string that is the SHA-1 hash of the Clojure: (clj-uuid/v1) ClojureScript: (cljs.core/random-uuid)
Inputs: [] Returns: s/Str Returns a string that is the SHA-1 hash of the Clojure: (clj-uuid/v1) ClojureScript: (cljs.core/random-uuid)
(shell-cmd cmd-str)
Runs a command string in the default OS shell (/bin/bash); returns result in a Clojure map. Example:
(shell-cmd "ls -ldF *")
;=> {:exit 0 ; unix exit status (0 -> normal) :err '' ; text from any errors :out '...' ; text output as would printed to console }
Runs a command string in the default OS shell (/bin/bash); returns result in a Clojure map. Example: (shell-cmd "ls -ldF *") ;=> {:exit 0 ; unix exit status (0 -> normal) :err '' ; text from any errors :out '...' ; text output as would printed to console }
(signed-byte->hex signed-byte)
Inputs: [signed-byte] Returns: s/Str
Converts a sequence of unsigned bytes [0..255] to a hex string, where each byte becomes 2 hex digits.
Inputs: [signed-byte] Returns: s/Str Converts a sequence of unsigned bytes [0..255] to a hex string, where each byte becomes 2 hex digits.
(str->byte-array str-val)
Inputs: [str-val :- s/Str]
Inputs: [str-val :- s/Str]
Returns the SHA-1 hex string for a string
Returns the SHA-1 hex string for a string
(str->sha str-val)
Inputs: [str-val :- s/Str]
Inputs: [str-val :- s/Str]
(take-dist n coll)
Returns a sequence of n items from a collection, distributed evenly between first & last elements, which are always included.
Returns a sequence of n items from a collection, distributed evenly between first & last elements, which are always included.
(unsigned-byte->hex unsigned-byte)
Inputs: [unsigned-byte] Returns: s/Str
Converts a sequence of unsigned bytes [0..255] to a hex string, where each byte becomes 2 hex digits.
Inputs: [unsigned-byte] Returns: s/Str Converts a sequence of unsigned bytes [0..255] to a hex string, where each byte becomes 2 hex digits.
(uuid->sha uuid)
Returns the SHA-1 hex string for a UUID's string representation
Returns the SHA-1 hex string for a UUID's string representation
(with-dots & body)
Increments indentation level of all spy, spyx, or spyxx expressions within the body.
Increments indentation level of all spy, spyx, or spyxx expressions within the body.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close