General helper functions.
If you think one of these functions should "graduate" to another library
or package, let me know at: github.com/bennn/gtp-util/issues
Flat contract for non-negative real numbers.
Flat contract for exact integers bewteen 0 and 9, inclusive.
Similar to listof
, but rejects lists that contain two or more equal?
Return a 95% confidence interval for the given numbers at the given confidence value.
Split a string by tab characters.
Join a list of strings by tab characters.
Convert a path or string to a string.
Convert a path or string to a path.
If the given directory exists, do nothing.
Otherwise, create it.
Round the given number to two decimal places.
Returns the same result as (~r n #:precision '(= 2))
except that it can be typed faster.
Compute the base-2 logarithm of a number.
Assumes n is a power of 2.
Remove the extension from the given filename.
Write the given pict to the given filename in .png format.
Divide a list into almost-equally-sized lists.
|> (columnize '(a b c d e f) 2)|
'((a c e) (b d f))
|> (columnize '(a b c d e) 2)|
'((a c e) (b d))
Divide a list into lists of length n, but the final
list may be shorter.
|> (take* '(a b c d e f) 2)|
'((a b) (c d) (e f))
|> (take* '(a b c d e) 2)|
'((a b) (c d) (e))
Force the given thunk and record its running time.
Return both the result of the thunk and the CPU time (as reported by time-apply
Parse a string from the time
macro into a sequence of integers.
Parse the corresponding field from a time
Predicate for a string of #\1 and #\0 characters.
Return a binary representation of n using exactly k bits.
Parse a string of "1" and "0" digits as a binary number,
return the base-10 representation of the parsed number.
Count the number of #\0 characters in a string of "1" and
Copy every file from the directory src
whose name matches the given glob
pattern into the directory dst
Raises an exception if src
contains a directory that matches the given pattern.
Copy every file and recursively copy every directory in src whose name matches the given pattern into the directory dst.
Given a list of values '(A B C) return a list with each value indexed by its position '((0 . A) (1 . B) (2 . C)).
See also in-indexed and in-naturals.
Explode an integer to a list of its digits.
Concatenate a sequence of digits into an integer.
Sort a list of filenames.
Predicate for strings that contain only whitespace characters.
Predicate for a string that begins with a semicolon.
to parse a value from a string.
1 System Calls
Convenience API for making system calls.
See also racket/system.
Finds the executable that cmd
denotes, then invokes it with the given arguments.
Returns a string containing all output from the system call.
Raises an exn:fail:user?
exception if the executable exits uncleanly.