hu.dwim.util

API Reference

hu.dwim.util

Various utilities, this is the most basic system that only introduce a small number of external dependencies.

HU.DWIM.UTIL

  • Function PATTERN-MATCH (pattern input &optional (bindings +no-bindings+))
    Match pattern against input in the context of the bindings
  • Macro PATTERN-CASE (expr &body clauses)
  • Macro NOTF (&rest places)
  • Macro CLEARF (&rest places)
  • Function SYMBOL-GLOBAL-VALUE (symbol)
  • Function (setf SYMBOL-GLOBAL-VALUE) (value symbol)
  • Function THE-ONLY-ELEMENT (elements)
  • Function THE-NON-NIL (value)
  • Function ENSURE-SEQUENCE (thing)
  • Function SUBSEQ-IF-LONGER (limit sequence &key postfix)
  • Function ALL-THE-SAME? (sequence &key (test 'eql) key)
    Returns true if every element in the LIST are equal to each other using TEST.
  • Function COLLECT-IF (predicate sequence &key (key #'identity))
    Collects elements from SEQUENCE for which the PREDICATE is true into a freshly allocated sequence.
  • Function OPTIONAL-LIST (&rest elements)
  • Function OPTIONAL-LIST* (&rest elements)
  • Macro FOREACH (function first-sequence &rest more-sequences)
  • Function PARTITION (sequence &rest predicates)
  • Function SPLIT-SEQUENCE-BY-PARTITIONING (sequence &rest predicates)
  • Function SPLIT-SEQUENCE (delimiter seq &key (count nil) (remove-empty-subseqs nil) (from-end nil) (start 0) (end (length seq)) test test-not key)
    Return a list of subsequences in seq delimited by delimiter. If :remove-empty-subseqs is NIL, empty subsequences will be included in the result; otherwise they will be discarded. All other keywords work analogously to those for CL:SUBSTITUTE. In particular, the behaviour of :from-end is possibly different from other versions of this function; :from-end values of NIL and T are equivalent unless :count is supplied. The second return value is an index suitable as an argument to CL:SUBSEQ into the sequence indicating where processing stopped.
  • Function SUBSTITUTE-ALL (old-elements new-element sequence &key (test #'eql) (start 0) count end key from-end)
  • Function MAP/TREE (visitor sequence &key (key 'identity))
    Depth-first, returns with (VALUES).
  • Function FIND/TREE (item sequence &key (key 'identity) (test 'eql))
  • Function SUBSTITUTE/TREE (new old list &key from-end (test #'eql) (test-not nil) (end nil) (count nil) (key nil) (start 0))
    Starting from LIST non-destructively replaces OLD with NEW.
  • Function SHRINK-VECTOR (vector &optional (size (length vector)))
    Fast shrinking for simple vectors. It's not thread-safe, use only on local vectors!
  • Macro WITH-STRING-TYPE-DISPATCH ((variable &optional (types '(simple-base-string simple-string string))) &body body)
  • Function SANITIZE-STRING (string lower-limit upper-limit &key (replacement #\?))
    By default sanitize for the printable ASCII range. Limits are inclusive.
  • Function SANITIZE-STRING/PRINTABLE-ASCII (string &key (replacement #\?))
  • Function MAKE-ADJUSTABLE-STRING (initial-contents)
  • Function FIND-SYMBOL* (symbol-name &key packages (otherwise :error otherwise?))
  • Variable +WHITESPACE-CHARACTERS+
    (hu.dwim.def::%reevaluate-constant 'hu.dwim.util:+whitespace-characters+ (coerce '(#\  #\tab #\newline #\return #\page) 'simple-base-string) :test 'equal)
  • Function STRING-TRIM-WHITESPACE (text)
  • Function WHITESPACE? (character)
  • Macro STRING/TRIM-WHITESPACE-AND-MAYBE-NIL-IT (variable)
  • Function MAKE-STRING-OF-SPACES (count)
  • Function WRITE-SPACES (count &optional (stream *standard-output*))
  • Function WRITE-CHARACTERS (character count &optional (stream *standard-output*))
  • Function ROMAN-NUMERAL-DIGIT-CHARACTER? (char)
  • Function PARSE-ROMAN-NUMERAL (str &key (start 0) end)
  • Function STRING-WITH-NUMERIC< (str1 str2 digit-p parse-number &key (start1 0) (start2 0))
  • Function STRING-WITH-INTEGERS< (str1 str2 &key (start1 0) (start2 0))
  • Function STRING-WITH-ROMAN-NUMERALS< (str1 str2 &key (start1 0) (start2 0))
  • Variable +LOWER-CASE-ASCII-ALPHABET+
    (hu.dwim.def::%reevaluate-constant 'hu.dwim.util:+lower-case-ascii-alphabet+ (coerce "abcdefghijklmnopqrstuvwxyz" 'simple-base-string) :test 'equal)
  • Variable +UPPER-CASE-ASCII-ALPHABET+
    (hu.dwim.def::%reevaluate-constant 'hu.dwim.util:+upper-case-ascii-alphabet+ (coerce "abcdefghijklmnopqrstuvwxyz" 'simple-base-string) :test 'equal)
  • Variable +ASCII-ALPHABET+
    (hu.dwim.def::%reevaluate-constant 'hu.dwim.util:+ascii-alphabet+
                                       (coerce (concatenate 'string hu.dwim.util:+upper-case-ascii-alphabet+ hu.dwim.util:+lower-case-ascii-alphabet+)
                                               'simple-base-string)
                                       :test 'equal)
  • Variable +ALPHANUMERIC-ASCII-ALPHABET+
    (hu.dwim.def::%reevaluate-constant 'hu.dwim.util:+alphanumeric-ascii-alphabet+
                                       (coerce (concatenate 'string hu.dwim.util:+ascii-alphabet+ "0123456789") 'simple-base-string) :test 'equal)
  • Variable +BASE64-ALPHABET+
    (hu.dwim.def::%reevaluate-constant 'hu.dwim.util:+base64-alphabet+
                                       (coerce (concatenate 'string hu.dwim.util:+alphanumeric-ascii-alphabet+ "+/") 'simple-base-string) :test 'equal)
  • Function RANDOM-STRING (&optional length (alphabet +ascii-alphabet+) prefix)
  • Function LEVENSHTEIN-DISTANCE (s1 s2)
  • Function LEVENSHTEIN-RELATIVE-DISTANCE (s1 s2)
  • Function STRING+ (&rest args)
  • Function JOIN-STRINGS (strings &optional separator)
  • Struct ATOMIC-COUNTER
    COUNTER
  • Function MAKE-ATOMIC-COUNTER (&key ((counter counter) 0))
  • Function ATOMIC-COUNTER/INCREMENT (atomic-counter &optional (delta 1))
    Increments a special place holding a machine word sized integer in a way that paralell CPU's don't step on each other's toes when incrementing/decrementing it. These operation don't expand to bignums, they just overflow/underflow when the high/low bound of the word sized integer is crossed.
  • Function ATOMIC-COUNTER/DECREMENT (atomic-counter &optional (delta 1))
    A convenience version of ATOMIC-COUNTER/INCREMENT, mostly to keep the user code readable.
  • Function ATOMIC-COUNTER/VALUE (atomic-counter)
    See ATOMIC-COUNTER for details.
  • Variable +TOP-TYPE+
    (hu.dwim.def::%reevaluate-constant 'hu.dwim.util:+top-type+ t :test 'equal)
  • Variable +BOTTOM-TYPE+
    (hu.dwim.def::%reevaluate-constant 'hu.dwim.util:+bottom-type+ nil :test 'equal)
  • Type FUNCTION-NAME
  • Type FUNCTION-DESIGNATOR
  • Function EXPAND-TYPE (type &optional env)
  • Function EXPAND-TYPE-1 (type &optional env)
  • Function TYPE-INSTANCE-COUNT-UPPER-BOUND (input-type)
  • Function TYPE-INSTANCE-LIST (type)
  • Variable +XML-NAMESPACE-URI+
    (hu.dwim.def::%reevaluate-constant 'hu.dwim.util:+xml-namespace-uri+ "http://www.w3.org/xml/1998/namespace" :test 'equal)
  • Function ENABLE-STANDARD-HU.DWIM-SYNTAXES
    This function sets up the common readtable modifications we (http://dwim.hu) use in almost all of our projects. Some projects enable more, but this is available almost everywhere.
  • Macro EVAL-ALWAYS (&body body)
  • Function EVAL/INTERPRET (form)
  • Variable +PROCESS-RETURN-CODE/NO-ERROR+
    (hu.dwim.def::%reevaluate-constant 'hu.dwim.util:+process-return-code/no-error+ 0 :test 'equal)
  • Function QUIT (status-code)
  • Macro WITH-KEYWORD-PACKAGE (&body body)
  • Function FULLY-QUALIFIED-SYMBOL-NAME (symbol &key separator)
  • Function FIND-FULLY-QUALIFIED-SYMBOL (name &key (otherwise nil))
    The inverse of FULLY-QUALIFIED-SYMBOL-NAME. Does not INTERN but it does instantiate package-less symbols.
  • Macro WITH-PROFILING (nil &body with-body162)
  • Function IF-SYMBOL-EXISTS (package name)
    Can be used to conditionalize at read-time like this: #+#.(hu.dwim.util:if-symbol-exists "PKG" "FOO")(pkg::foo ...)
  • Macro SURROUND-BODY-WHEN (test surround-with &body body)
  • Macro SURROUND-BODY-WHEN* ((test surround-with &key (body-name '-body-)) &body body)
  • Macro SURROUND-BODY-UNLESS (test surround-with &body body)
  • Macro SURROUND-BODY-UNLESS* ((test surround-with &key (body-name '-body-)) &body body)
  • Function GET-MONOTONIC-TIME
    Returns such a time measure that constantly grows (it's a number in seconds, and it's unaffected by setting the system clock).
  • Macro WITH-MUFFLED-WARNINGS ((&rest types) &body body)
  • Macro WITH-MUFFLED-REDEFINITION-WARNINGS (&body body)
  • Macro WITH-MUFFLED-BORING-COMPILER-WARNINGS (&body body)
  • Macro REBIND (bindings &body body)
  • Function NOT-YET-IMPLEMENTED (&optional (datum "not yet implemented." datum?) &rest args)
  • Function NOT-YET-IMPLEMENTED/FORM (name &key (runtime-signal-kind 'error))
  • Function NOT-YET-IMPLEMENTED/CRUCIAL-API (name)
  • Function OPERATION-NOT-SUPPORTED (&optional (datum "operation not supported." datum?) &rest args)
  • Macro TO-BOOLEAN (form)
  • Macro WITH-THREAD-NAME (name &body body)
  • Macro WITH-THREAD-ACTIVITY-DESCRIPTION ((name) &body body)
    This is a debugging helper tool. Information provided here may show up in backtraces unless compiled without the debug helpers.
  • Function HANDLE-OTHERWISE/VALUE (otherwise &key default-message)
  • Macro HANDLE-OTHERWISE (&body default-error-forms)
  • Macro HANDLE-OTHERWISE* ((&key default-message) &body default-forms)
  • Function MANDATORY-ARGUMENT
  • Macro ECOND (&whole whole &rest clauses)
  • Function QUOTED-FORM? (thing)
  • Function QUOTED-SYMBOL? (thing)
  • Function FIND-FUNCTION (name &key (otherwise :error otherwise?))
  • Macro WITH-DYNAMIC-MEMOIZE ((name &rest keys) &body forms)
  • Function FIND-SLOT (class-or-name slot-name &key (otherwise :error otherwise?))
  • Function FIND-DIRECT-SLOT (class-or-name slot-name &key (otherwise :error otherwise?))
  • Macro BIT-VALUE (index integer)
    Returns the INDEX'th bit of INTEGER as a boolean.
  • Macro WITH-PROFILING (nil &body with-body3)

Also exports

  • ITERATE:COLLECT
  • COMMON-LISP:OTHERWISE
  • HU.DWIM.COMMON:SUM

hu.dwim.util+iolib

Integration of hu.dwim.util with iolib.

No packages.

hu.dwim.util.documentation

No packages.

hu.dwim.util.test

No packages.