smangler library, core imports.
smangler library, core imports.
(all-prefixes p)
(all-prefixes pred p)
Generates a lazy sequence of all possible prefixes of a given string. Returns nil if nil or an empty string was given as an argument instead of a string.
It automatically converts objects of the following types to strings: characters, numbers, sequences of characters, collections of strings, collections of characters, collections of numbers. For collections it joins the elements converted to strings.
The resulting sequence will contain the whole string on its last position.
If two arguments are given the first one should be a function used to partition the given string. It should take a single character and return an object. The given string will be split whenever this function will return new value. That way the suffixes will be generated for parts of the string instead of separate characters.
Generates a lazy sequence of all possible prefixes of a given string. Returns nil if nil or an empty string was given as an argument instead of a string. It automatically converts objects of the following types to strings: characters, numbers, sequences of characters, collections of strings, collections of characters, collections of numbers. For collections it joins the elements converted to strings. The resulting sequence will contain the whole string on its last position. If two arguments are given the first one should be a function used to partition the given string. It should take a single character and return an object. The given string will be split whenever this function will return new value. That way the suffixes will be generated for parts of the string instead of separate characters.
(all-subs p)
(all-subs pred p)
Generates a lazy sequence of all possible substrings (prefixes, suffixes and infixes) of a given string. Returns nil if nil or an empty string was given as an argument instead of a string.
The resulting sequence will contain the whole string in its middle. Moreover, the substrings will not be unique across the sequence if the characters are repeating in the input.
If two arguments are given the first one should be a function used to partition the given string. It should take a single character and return an object. The given string will be split whenever this function will return new value. That way the substrings will be generated for parts of the string instead of separate characters.
Generates a lazy sequence of all possible substrings (prefixes, suffixes and infixes) of a given string. Returns nil if nil or an empty string was given as an argument instead of a string. The resulting sequence will contain the whole string in its middle. Moreover, the substrings will not be unique across the sequence if the characters are repeating in the input. If two arguments are given the first one should be a function used to partition the given string. It should take a single character and return an object. The given string will be split whenever this function will return new value. That way the substrings will be generated for parts of the string instead of separate characters.
(all-suffixes p)
(all-suffixes pred p)
Generates a lazy sequence of all possible suffixes of a given string. Returns nil if nil or an empty string was given as an argument instead of a string.
The resulting sequence will contain the whole string on its first position.
If two arguments are given the first one should be a function used to partition the given string. It should take a single character and return an object. The given string will be split whenever this function will return new value. That way the prefixes will be generated for parts of the string instead of separate characters.
Generates a lazy sequence of all possible suffixes of a given string. Returns nil if nil or an empty string was given as an argument instead of a string. The resulting sequence will contain the whole string on its first position. If two arguments are given the first one should be a function used to partition the given string. It should take a single character and return an object. The given string will be split whenever this function will return new value. That way the prefixes will be generated for parts of the string instead of separate characters.
(trim-both p)
(trim-both matcher p)
(trim-both start end p)
Takes a string and recursively trims its first and last character if they are equal. Returns a new string or nil when nil was passed as an argument instead of a string. For an empty string it returns an empty string.
When the matcher argument is present it specifies a matching function used to decide whether to trim first and last character. The given function should take a character and make a lookup to decide whether a character should be trimmed from the beginning of a string. Additionally, its returned value (if a character) is then used to match the last character of the string. Therefore the returned value should be a character (the same or different as passed), nil or false (to indicate a failed match). The trimming function will trim a string on both ends if a value returned by the matcher is equal to the last character of this string. It's common to use a set (to match the same characters on both ends) or a map (to match different characters).
When 3 arguments are given the first two should be characters used to match first and last character of a trimmed string (given as third argument).
When the string consist of 2 matching letters the result will be an empty string.
Takes a string and recursively trims its first and last character if they are equal. Returns a new string or nil when nil was passed as an argument instead of a string. For an empty string it returns an empty string. When the matcher argument is present it specifies a matching function used to decide whether to trim first and last character. The given function should take a character and make a lookup to decide whether a character should be trimmed from the beginning of a string. Additionally, its returned value (if a character) is then used to match the last character of the string. Therefore the returned value should be a character (the same or different as passed), nil or false (to indicate a failed match). The trimming function will trim a string on both ends if a value returned by the matcher is equal to the last character of this string. It's common to use a set (to match the same characters on both ends) or a map (to match different characters). When 3 arguments are given the first two should be characters used to match first and last character of a trimmed string (given as third argument). When the string consist of 2 matching letters the result will be an empty string.
(trim-both-once p)
(trim-both-once matcher p)
(trim-both-once start end p)
Takes a string and trims its first and last character if they are equal. Returns a new string or nil when there is nothing to trim or nil was passed as an argument instead of a string. For an empty string it also returns nil.
When the matcher argument is present it specifies a matching function used to decide whether to trim first and last character. The given function should take a character and make a lookup to decide whether a character should be trimmed from the beginning of a string. Additionally, its returned value (if a character) is then used to match the last character of the string. Therefore the returned value should be a character (the same or different as passed), nil or false (to indicate a failed match). The trimming function will trim a string on both ends if a value returned by the matcher is equal to the last character of this string. It's common to use a set (to match the same characters on both ends) or a map (to match different characters).
When 3 arguments are given the first two should be characters used to match first and last character of a trimmed string (given as third argument).
When the string consist of 2 matching letters the result will be an empty string.
Takes a string and trims its first and last character if they are equal. Returns a new string or nil when there is nothing to trim or nil was passed as an argument instead of a string. For an empty string it also returns nil. When the matcher argument is present it specifies a matching function used to decide whether to trim first and last character. The given function should take a character and make a lookup to decide whether a character should be trimmed from the beginning of a string. Additionally, its returned value (if a character) is then used to match the last character of the string. Therefore the returned value should be a character (the same or different as passed), nil or false (to indicate a failed match). The trimming function will trim a string on both ends if a value returned by the matcher is equal to the last character of this string. It's common to use a set (to match the same characters on both ends) or a map (to match different characters). When 3 arguments are given the first two should be characters used to match first and last character of a trimmed string (given as third argument). When the string consist of 2 matching letters the result will be an empty string.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close