rutils

API Reference

rutils

A collection of basic utilities for syntactic extension and basic data structure hadling, developed over the years of CL history by efforts of different individuals, and gathered under the unbrella of a hierarchy of packages which can be used on-demand.

RUTILS.READTABLE

Literate syntax definitions.
  • Variable +DEFAULT-OPTS+
    '(optimize (speed 3) (space 1))
    Default optimization settings for RUTILS.
  • Function #v-reader (stream char arg)
    Literal syntax for vectors. Unlike #() evaluates its contents before vector creation Examples: CL-USER> #v(1 2 3) #(1 2 3) CL-USER> #v((+ 1 2)) #(3)
  • Function #h-reader (stream char arg)
    Literal syntax for hash-tables. Examples: CL-USER> #h(:a 1 :b 2) #<HASH-TABLE :TEST EQL :COUNT 2> ;; holding 2 key/value pairs: ((:a . 1) (:b . 2)) CL-USER> #h(equalp "a" 1 "b" 2) #<HASH-TABLE :TEST EQUALP :COUNT 2> ;; holding 2 key/value pairs: (("a" . 1) ...)
  • Function #{-reader (stream char arg)
    Literal syntax for fixed-size hash-tables. Examples: CL-USER> #{:a 1 :b 2} #<HASH-TABLE :TEST EQL :COUNT 2> ;; holding 2 key/value pairs: ((:a . 1) (:b . 2)) CL-USER> #{equalp "a" 1 "b" 2} #<HASH-TABLE :TEST EQUALP :COUNT 2> ;; holding 2 key/value pairs: (("a" . 1) ...)
  • Function #`-reader (stream char arg)
    Literal syntax for zero/one/two argument lambdas. Use % as the function's argument, %% as the second. Examples: - #`(+ 2 %) => (lambda (&optional x y) (+ 2 x)) - #`((print %) (1+ %)) => (lambda (&optional x) (print x) (1+ x)) - #`(+ 1 2) => (lambda (&optional x y) (+ 1 2)) - #`(+ % %%) => (lambda (&optional x y) (+ x y))
  • Function #/-reader (stream char arg)
    Literal syntax for raw strings (which don't need escapin of control chars). Example: CL-USER> #/This is a "test" string/# "This is a \"test\" string" ;; here " are actually unescaped, but you can't write it in a docstring :)

RUTILS.CORE

Core utilities.
  • Condition RUTILS-STYLE-WARNING  (SIMPLE-CONDITION, STYLE-WARNING)
  • Macro EVAL-ALWAYS (&body body)
    Wrap BODY in eval-when with all keys (compile, load and execute) mentioned.
  • Macro ABBR (short long &optional lambda-list)
    Abbreviate LONG macro or function name as SHORT. If LAMBDA-LIST is present, also copy appropriate SETF-expander.
  • Function MAKE-GENSYM-LIST (length &optional (x "g"))
    Return a list of LENGTH gensyms, using the second (optional, defaulting to 'G') argument.
  • Macro WITH-GENSYMS ((&rest names) &body body)
    Provide gensyms for given NAMES.
  • Function ENSURE-SYMBOL (obj &key (format "~a") package)
    Make a symbol in either PACKAGE or *PACKAGE* from OBJ according to FORMAT.
  • Function ENSURE-KEYWORD (obj &key (format "~a"))
    Make a keyword from OBJ according to FORMAT.
  • Function PACKAGE-SYMBOLS (package)
    List all symbols in a PACKAGE.
  • Function PACKAGE-INTERNAL-SYMBOLS (package)
    List all symbols in a PACKAGE that are not imported.
  • Function PACKAGE-EXTERNAL-SYMBOLS (package)
    List all symbols in a PACKAGE.
  • Function RE-EXPORT-SYMBOLS (from-package to-package)
    Make the exported symbols in FROM-PACKAGE be also exported from TO-PACKAGE.

RUTILS.MISC

Assorted small utilities.
  • Macro MULTIPLE-VALUE-PROG2 (first-form second-form &body forms)
    Evaluates FIRST-FORM, then SECOND-FORM, and then FORMS. Yields as its value all the value returned by SECOND-FORM.
  • Function OR2 (x y)
    OR for 2 arguments as a function.
  • Function AND2 (x y)
    AND for 2 arguments as a function.
  • Function XOR2 (x y)
    XOR for 2 arguments as a function.
  • Macro XOR (&rest args)
    Evaluates the ARGS one at a time. If more than one is T, evaluation stops and NIL is returned. If exactly one arg is T, that value is returned.
  • Function LESS (x y)
    Like <, but works for NIL values of X and Y. Obviously, NIL is LESS, than anything, including itself.
  • Function NOT-MORE (x y)
    Like <=, but works for NIL values of X and Y. Obviously, NIL is NOT-MORE, than anything, including itself.
  • Function MORE (x y)
    Like >, but works for NIL values of X and Y. Obviously, NIL is not MORE, than anything, including itself.
  • Function NOT-LESS (x y)
    Like >=, but works for NIL values of X and Y. Obviously, NIL is not NOT-LESS, than anything, including itself.
  • Function TRUE (val)
    The complement to NULL. Unlike IDENTITY will return T if VAL is not NIL.
  • Macro NAMED-LAMBDA (name lambda-list &body body)
    Expands into a lambda-expression within whose BODY NAME denotes the corresponding function.
  • Macro COERCEF (place type-spec &environment env)
    Modify-macro for COERCE.
  • Macro VOID (place)
    Nullify PLACE.
  • Macro RE-SETF (var &rest clauses)
    SETFs VAR to the value of each clause subsequently. Re-uses the new value of VAR in subsequent clauses. Expects VAR to be a valid place for SETF.
  • Macro 2ND (form)
    (NTH-VALUE 1 FORM)
  • Macro ONCE-ONLY (specs &body forms)
    Evaluate FORMS with names rebound to temporary variables, ensuring that each is evaluated only once. Each SPEC must be either a NAME, or a (NAME INITFORM), with plain NAME using the named variable as initform. Example: CL-USER> (defmacro cons1 (x) (once-only (x) `(cons ,x ,x))) CL-USER> (let ((y 0)) (cons1 (incf y))) (1 . 1)
  • Condition CASE-FAILURE  (CASE-FAILURE, TYPE-ERROR)
  • Macro PCASE (pred keyform &rest clauses)
    Like CASE, but uses given PRED instead of EQL to select appropriate CLAUSE. Example usage: CL-USER> (pcase '< 1 (0 (print "Below zero")) (2 (print "OK")) (otherwise (error "Oops")))
  • Macro PCCASE (pred keyform &rest clauses)
    Like CCASE, but uses given PRED instead of EQL to select appropriate CLAUSE. Example usage: CL-USER> (pccase '< 1 (0 (print "Below zero")) (2 (print "OK")))
  • Macro PECASE (pred keyform &rest clauses)
    Like ECASE, but uses given PRED instead of EQL to select appropriate CLAUSE. Example usage: CL-USER> (pecase '< 1 (0 (print "Below zero")) (2 (print "OK")))
  • Macro DCASE (keyform &body clauses)
    DCASE is a combination of CASE and DESTRUCTURING-BIND. KEYFORM must evaluate to a CONS. Clauses are of the form: ((CASE-KEYS . DESTRUCTURING-LAMBDA-LIST) FORM*) The clause whose CASE-KEYS matches CAR of KEY, as if by CASE, is selected, and FORMs are then executed with CDR of KEY is destructured and bound by the DESTRUCTURING-LAMBDA-LIST.
  • Macro DCCASE (keyform &body clauses)
    DCCASE is a combination of CCASE and DESTRUCTURING-BIND. KEYFORM must evaluate to a CONS. Clauses are of the form: ((CASE-KEYS . DESTRUCTURING-LAMBDA-LIST) FORM*) The clause whose CASE-KEYS matches CAR of KEY, as if by CCASE, is selected, and FORMs are then executed with CDR of KEY is destructured and bound by the DESTRUCTURING-LAMBDA-LIST.
  • Macro DECASE (keyform &body clauses)
    DECASE is a combination of ECASE and DESTRUCTURING-BIND. KEYFORM must evaluate to a CONS. Clauses are of the form: ((CASE-KEYS . DESTRUCTURING-LAMBDA-LIST) FORM*) The clause whose CASE-KEYS matches CAR of KEY, as if by ECASE, is selected, and FORMs are then executed with CDR of KEY is destructured and bound by the DESTRUCTURING-LAMBDA-LIST.
  • Macro SWITCH (&whole whole (object &key (test ''eql) (key ''identity)) &body clauses)
    Evaluate first matching clause, returning its values, or evaluates and returns the values of DEFAULT if no keys match.
  • Macro CSWITCH (&whole whole (object &key (test ''eql) (key ''identity)) &body clauses)
    Like SWITCH, but signals a continuable error if no key matches.
  • Macro ESWITCH (&whole whole (object &key (test ''eql) (key ''identity)) &body clauses)
    Like SWITCH, but signals an error if no key matches.

RUTILS.ANAPHORA

Anaphoric control constructs.
  • Macro IF-IT (test then &optional else)
    Like IF. IT is bound to TEST.
  • Macro WHEN-IT (test &body body)
    Like WHEN. IT is bound to TEST.
  • Macro AND-IT (&rest args)
    Like AND. IT is bound to the value of the previous AND form.
  • Macro DOWHILE-IT (test &body body)
    Like DOWHILE. IT is bound to TEST.
  • Macro COND-IT (&body body)
    Like COND. IT is bound to the passed COND test.
  • Macro IF-LET ((var test) then &optional else)
    Like IF. VAR will be bound to TEST.
  • Macro WHEN-LET ((var test) &body body)
    Like WHEN. VAR will be bound to TEST.
  • Macro AND-LET (var &rest args)
    Like AND. VAR will be bound to the value of the previous AND form
  • Macro DOWHILE-LET ((var test) &body body)
    Like DOWHILE. VAR will be bound to TEST.
  • Macro COND-LET (var &body body)
    Like COND. VAR will be bound to the passed COND test.

RUTILS.LIST

List utilities.
  • Function LAST1 (list &optional (n 1))
    Get the N-th element of LIST from end, starting from the last one (which is number 1).
  • Function (setf LAST1) (object list &optional (n 1))
  • Function BUTLAST2 (list &optional (n 1))
    Split LIST in 2 parts and return them as multiple values: head and tail. If (= N 1), which is the most common case, the tail will be a single element, otherwise -- a list as well.
  • Function SINGLE (list)
    Test wheather LIST contains exactly 1 element.
  • Function DYADIC (list)
    Test wheather LIST contains exactly 2 elements.
  • Function TRYADIC (list)
    Test wheather LIST contains exactly 3 elements.
  • Function ENSURE-LIST (obj)
    Wrap OBJ in a list, if it's not a list.
  • Macro WITH-OUTPUT-TO-LIST ((out) &body body)
    A simple list analog of WITH-OUTPUT-TO-STRING, which supports the general pattern of using list as an accumulator. OUT is bound to a fresh list, that will be returned nreversed. BODY is wraped in implicit block NIL.
  • Function FLATTEN (list &optional level)
    Flatten possibly nested LIST a given number of LEVELs (or to the end).
  • Function INTERLEAVE (list &rest lists)
    Return a list whose elements are taken from LIST and each of LISTS like this: 1st of list, 1st of 1st of lists,..., 1st of last of lists, 2nd of list,...
  • Function INTERPOSE (separator list)
    Returns a sequence of the elements of SEQUENCE separated by SEPARATOR.
  • Function TAKE (n list &optional (step 1))
    Return a list with N elements, which are taken from LIST by this formula: INDEX of ELEMENT = I * STEP for I from 0
  • Function PLISTP (list)
    Test wheather LIST is a properly formed plist.
  • Function ALISTP (list)
    Test wheather LIST is a properly formed alist.
  • Function ALIST-TO-PLIST (alist)
    Make a plist from an alist ALIST.
  • Function PLIST-TO-ALIST (plist)
    Make an alist from a plist PLIST.
  • Function REMOVE-FROM-PLIST (plist &rest keys)
    Returns a propery-list with same keys and values as PLIST, except that keys in the list designated by KEYS and values, corresponding to them are removed. The returned property-list may share structure with the PLIST, but PLIST is not destructively modified. Keys are compared using EQ.
  • Function DELETE-FROM-PLIST (plist &rest keys)
    Just like REMOVE-FROM-PLIST, but this version may destructively modify the provided PLIST.
  • Function ASSOC1 (item alist &key default key (test nil testp) (test-not nil notp))
    Return a value in ALIST, whose key is eql to ITEM. Also as 2nd value return, whether ITEM was found. If there is no such entry, returns DEFAULT. The usual KEY, TEST and TEST-NOT arguments apply.
  • Function ATOMIZE (list-or-val)
  • Macro APPENDF (place &rest lists &environment env)
    Modify-macro for APPEND. Appends LISTS to the place designated by the first argument.
  • Macro NCONCF (place &rest lists &environment env)
    Modify-macro for NCONC. Concatenates LISTS to place designated by the first argument.
  • Macro UNIONF (place list &rest args &environment env)
    Modify-macro for UNION. Saves the union of LIST and the contents of the place designated by the first argument to the designated place.
  • Macro NUNIONF (place list &rest args &environment env)
    Modify-macro for NUNION. Saves the union of LIST and the contents of the place designated by the first argument to the designated place. May modify either argument.
  • Macro REVERSEF (place &environment env)
    Modify-macro for REVERSE. Copies and reverses the list stored in the given place and saves back the result into the place.
  • Macro NREVERSEF (place &environment env)
    Modify-macro for NREVERSE. Reverses the list stored in the given place by destructively modifying it and saves back the result into the place.
  • Macro DOPLIST ((key val plist &optional rez) &body body)
    Like DOLIST but iterate over 2 items of the PLIST at once, onsidered KEY and VAL. Asserts proper PLIST.
  • Function SET-EQUAL (list1 list2 &key (test 'eql) (key nil keyp))
    Return true if every element of LIST1 matches some element of LIST2 and every element of LIST2 matches some element of LIST1. Otherwise returns false.
  • Function ZIP (&rest lists)
    Return a single list whose elements are lists of the consecutive elements of LISTS, until one of the LISTS ends.
  • Function ZIP-WITH (fn &rest lists)
    Return a single list whose elements are the results of applying FN to groups of the consecutive elements of LISTS, until one of the LISTS ends.
  • Function ZIP* (&rest lists)
    Return a single list whose elements are lists of the consecutive elements of LISTS, until all of the LISTS end.
  • Function ZIP*-WITH (fn &rest lists)
    Return a single list whose elements are the results of applying FN to groups of the consecutive elements of LISTS, until all of the LISTS end.
  • Function MAPTIMES (times fn)
    Map FN with number range from 0 to TIMES (exclusive).
  • Function MAPINDEX (fn list)
    Mapcar FN with 2 lists: - numeric inidices for LIST, starting from 0 - LIST itself
  • Function MAPCANINDEX (fn list)
    Mapcan FN with 2 lists: - numeric inidices for LIST, starting from 0 - LIST itself
  • Function MAPPEND (function &rest lists)
    Apply FUNCTION to respective elements of each LIST, appending all the result lists to a single list. FUNCTION must return a list.
  • Function REMOVE-IDX (idx list)
    Return a copy of the list without IDX-th element.
  • Function PERMUTATIONS (list)
    Generate all permutations of LIST. Complexity: O(n!)
  • Macro LISTCASE (list &body cases)
    A typecase-like macro to destinguish between 3 possible kinds of LIST: simple lists, alists, and dlists. Evaluates the appropriate key-form depending on the kind: ALIST, DLIST or simple list (T).
  • Function RANGE (start limit &key (step 1))
    Return a list of numbers, starting from START up to LIMIT incremented by STEP (default 1).
  • Function CONCAT (&rest lists)
    CONCATENATE all the LISTS into a single list.
  • Function DCONS (key val dlist)
    Add KEY-VAL pair to the front of DLIST.
  • Function DLISTP (list)
    Test wheather LIST is a properly formed dlist, i.e. a list-structure of the form: ((keys) vals).

RUTILS.STRING

String utilities.
  • Function STRCAT (&rest string-designators)
    CONCATENATE all the strings in STRING-DESIGNATORS.
  • Function STRJOIN (delim strings)
    Join STRINGS with DELIM.
  • Function BLANKP (string)
    Test whether a STRING is blank (empty).
  • Function READ-FILE (filename)
    Read a whole file by FILENAME into a string.
  • Function WHITE-CHAR-P (char)
    Is CHAR a whitespace character (newline chars are also considered white).
  • Function SPLIT-STRING (string)
    Split STRING by WHITE-CHAR-P.
  • Function SUBSTR (string start &optional end)
    Efficient substring of STRING from START to END (optional), where both can be negative, which means counting from the end.
  • Function STARTS-WITH (prefix string &key (test 'string=) (start 0))
    Test, whether STRING starts with PREFIX. If START is provided matches from this offset from the start.
  • Function ENDS-WITH (suffix string &key (test 'string=) -end)
    Test, whether STRING ends with SUFFIX. Accepts TEST. If -END is provided matches from this offset from end.
  • Type STRING-DESIGNATOR
    A string designator type. It is either a string, a symbol, or a character.
  • Macro DOLINES ((line src &optional result) &body body)
    Iterate over each LINE in SRC (a stream or path to a file) as in DOLIST.
  • Macro WITH-OUT-FILE ((var path) &body body)
  • Function LAST-CHAR (string)
    Return the last character of STRING if it's not empty, otherwise - nil.
  • Function FMT (format-string &rest args)
    (FORMAT NIL FORMAT-STRING ARGS)

RUTILS.HASH-TABLE

Hash-table utilities.
  • Function SETHASH (key ht val)
    Set VAL at KEY in hash-table HT.
  • Function TAKEHASH (key ht)
    Get and remove VAL at KEY in hash-table HT.
  • Macro GETSETHASH (key table new-value)
    Either get the value from TABLE by KEY or set a new calculated NEW-VALUE there and return it. It's similar to GETHASH called with 3 parameteres, but functions lazily.
  • Function COPY-HASH-TABLE (ht &key key test size rehash-size rehash-threshold)
    Returns a copy of hash table HT, with the same keys and values. The copy has the same properties as the original, unless overridden by the keyword arguments. Before each of the original values is set into the new hash-table, KEY is invoked on the value. As KEY defaults to IDENTITY a shallow copy is returned by default.
  • Function MERGE-HASH-TABLES (ht &rest hts)
    From 1 or more HTS create a single one with TEST of HT.
  • Function HASH-TABLE-KEYS (ht)
    Return a list of keys of hash-table HT.
  • Function HASH-TABLE-VALS (ht)
    Return a list of values of hash-table HT.
  • Function HASH-TABLE-FROM-PLIST (plist &rest hash-table-initargs)
    Returns a hash-table containing the keys and values, alternating in PLIST. Hash table is initialized using the HASH-TABLE-INITARGS.
  • Function HASH-TABLE-TO-PLIST (ht)
    Returns a list containing the keys and values of hash-table HT.
  • Function HASH-TABLE-FROM-ALIST (alist &rest hash-table-initargs)
    Returns a hash-table containing the keys and values, alternating in ALIST. Hash table is initialized using the HASH-TABLE-INITARGS.
  • Function HASH-TABLE-TO-ALIST (ht)
    Returns an alist containing the keys and values of hash-table HT.
  • Function PRINT-HASH-TABLE (ht &optional (stream *standard-output*))
    Pretty print hash-table HT to STREAM.
  • Macro WITH-KEYS ((&rest kv-pairs) ht &body body)
    Like WITH-ACCESSORS but for pairs in hash-table HT.
  • Macro DOTABLE ((k v table &optional rez) &body body)
    Like DOLIST but iterates over key-value pairs (K V) in anything, that can be viewed as a table (hash-table, alist, plist, object). Autodeclares variables named _ as ignored.
  • Function TOGGLE-PRINT-HASH-TABLE (&optional (on nil explicit))
    Toggles printing hash-tables with PRINT-HASH-TABLE or with default method. If ON is set explicitly will turn on literal printing (T) or default (NIL).
  • Function HASH-SET (seq &key (test 'eql))
    Create a hash-set with TEST from the SEQ.

RUTILS.ARRAY

Array utilities.
  • Type ARRAY-INDEX (&optional (length array-dimension-limit))
    Type designator for an index into array of LENGTH: an integer between 0 (inclusive) and LENGTH (exclusive). LENGTH defaults to ARRAY-DIMENSION-LIMIT.
  • Type ARRAY-LENGTH (&optional (length array-dimension-limit))
    Type designator for a dimension of an array of LENGTH: an integer between 0 (inclusive) and LENGTH (inclusive). LENGTH defaults to ARRAY-DIMENSION-LIMIT.
  • Function SLICE (vec beg &optional end)
    Return an array-slice into VEC from BEG to END.
  • Macro DOVEC ((var vec &optional result-form) &body body)
    Iterates over a vector (like in DOLIST).
  • Function VEC (&rest args)
    Make a new adjustable vector with ARGS as contents.
  • Function COPY-ARRAY (arr)
    Create a fresh copy of the array ARR.

RUTILS.SEQUENCE

Sequence utilities, including SPLIT-SEQUENCE.
  • Function SPLIT-SEQUENCE (delimiter seq &key (count nil) (remove-empty-subseqs nil) (from-end nil) (start 0) (end nil) (key nil key-supplied) (test nil test-supplied) (test-not nil test-not-supplied))
    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 SUBSTITUTE. In particular, the behavior 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 SUBSEQ into the sequence indicating where processing stopped.
  • Function SPLIT-SEQUENCE-IF (predicate seq &key (count nil) (remove-empty-subseqs nil) (from-end nil) (start 0) (end nil) (key nil key-supplied))
    Return a list of subsequences in SEQ delimited by items, satisfying PREDICATE. 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 SUBSTITUTE. In particular, the behavior 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 SUBSEQ into the sequence indicating where processing stopped.
  • Function SPLIT-SEQUENCE-IF-NOT (predicate seq &key (count nil) (remove-empty-subseqs nil) (from-end nil) (start 0) (end nil) (key nil key-supplied))
    Return a list of subsequences in SEQ delimited by items, satisfying (complement PREDICATE). 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 SUBSTITUTE. In particular, the behavior 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 SUBSEQ into the sequence indicating where processing stopped.
  • Function PARTITION-WITH (key-sequence sequence &key (ordering #'less) (test #'eql) (key nil key-p) (result-type 'list) keys-sorted)
    Partition a SEQUENCE into a sequence of sequences, each one related by TEST to one key in KEY-SEQUENCE (which may be already sorted: KEYS-SORTED). Returns a sorted KEY-SEQUENCE as a 2nd value. Return values are coerced to RESULT-TYPE, that should be a sequence subtype (default is LIST). ORDERING is used for sorting both SEQUENCE and KEY-SEQUENCE. Accepts KEY.
  • Macro REMOVEF (place item &rest remove-keywords &environment env)
    Modify-macro for REMOVE. Sets place designated by the first argument to the result of calling REMOVE with ITEM, place, and the REMOVE-KEYWORDS.
  • Macro DELETEF (place item &rest remove-keywords &environment env)
    Modify-macro for DELETE. Sets place designated by the first argument to the result of calling DELETE with ITEM, place, and the REMOVE-KEYWORDS.
  • Macro DOINDEX ((index-var elt-var sequence &optional result-form) &body body)
    Iterates over a sequence while keeping track of an index. A DO-style macro. Example usage: CL-USER> (doindex (i e '(a b c)) (format T "~&~S ~S" i e)) 1 a 2 b 3 c
  • Function SHUFFLE (sequence &key (start 0) end)
    Return a shuffled copy of SEQUENCE (in bounds of START and END).
  • Function NSHUFFLE (sequence &key (start 0) (end (length sequence)))
    Shuffle SEQUENCE (in bounds of START and END) in-place.
  • Function ROTATE (sequence &optional (n 1))
    Returns a sequence of the same type as SEQUENCE, with the elements of SEQUENCE rotated by N: N elements are moved from the end of the sequence to the front if N is positive, and -N elements moved from the front to the end if N is negative. SEQUENCE must be a proper sequence. N must be an integer, defaulting to 1. If absolute value of N is greater then the length of the sequence, the results are identical to calling ROTATE with (* (signum n) (mod n (length sequence))). Note: the original sequence may be destructively altered, and result sequence may share structure with it.
  • Function EMPTYP (sequence)
    Returns true if SEQUENCE is an empty sequence. Signals an error if SEQUENCE is not a sequence.
  • Function EQUAL-LENGTHS (&rest sequences)
    Takes any number of sequences or integers in any order. Returns true iff the length of all the sequences and the integers are equal. Hint: there's a compiler macro that expands into more efficient code if the first argument is a literal integer.
  • Function LENGTH= (sequence length)
    Return true if SEQUENCE's length equals LENGTH. Returns FALSE for circular lists. Signals an error if SEQUENCE is not a sequence.
  • Function LAST-ELT (sequence)
    Returns the last element of SEQUENCE. Signals a type-error if SEQUENCE is not a proper sequence, or is an empty sequence.
  • Function (setf LAST-ELT) (object sequence)
    Sets the last element of SEQUENCE. Signals a type-error if SEQUENCE is not a proper sequence, is an empty sequence.
  • Function SAFE-SORT (sequence predicate &rest args &key key)
    The destructuve nature of SORT triggers many obscure bugs. This function is a thin wrapper over SORT that enqures that an input SEQUENCE is copied.
  • Function GROUP (n seq)
    Split SEQ into a list of sequences of the same type of length N (the last sequence may be shorter).
  • Function KEEP (item sequence &rest args &key from-end test test-not start end count key)
    The opposite of REMOVE.
  • Function SUM (fn seq &rest seqs)
    Sum the results of mapping FN to SEQ and other SEQS.
  • Function PRODUCT (fn seq &rest seqs)
    Product of the results of mapping FN to SEQ and other SEQS.
  • Function MAP* (fn seq &rest seqs)
    DWIM version of map that uses the type of first sequence (SEQ) for result.

RUTILS.PAIR

Generic pair data structure.
  • Struct PAIR
    A generic pair with left (LT) and right (RT) elements.
    LT
    RT
  • Function LT (structure)
  • Function (setf LT) (value structure)
  • Function RT (structure)
  • Function (setf RT) (value structure)
  • Function MAKE-PAIR (&key ((lt lt) nil) ((rt rt) nil))
  • Function PAIR (x y)
    A shortcut to make a pair of X and Y.
  • Function HT->PAIRS (ht)
    Dump hash-table HT to list of pairs.
  • Function PAIRS->HT (pairs &rest hash-table-initargs)
    Create hash-table from the list of PAIRS. Hash table is initialized using the HASH-TABLE-INITARGS.
  • Generic-Function PAIRS (table)
    Return a list of all key-value PAIRS in a TABLE. Order is unspecified.
  • Method PAIRS ((list list))
  • Method PAIRS ((list list))
  • Method PAIRS ((list list))
  • Method PAIRS ((table hash-table))
  • Method PAIRS ((table hash-table))
  • Method PAIRS ((table hash-table))
  • Macro WITH-PAIR ((lt rt) pair &body body)
    Bind LT and RT to PAIR's slots and execute BODY inside.

RUTILS.TREE

Tree utilities.
  • Macro DOTREE ((subtree tree &optional result) &body body)
    Iterate over each SUBTREE of the TREE in depth-first order. Optionally return RESULT.
  • Macro DOLEAVES ((node tree &optional result) &body body)
    Iterate over each leaf NODE of the TREE in depth-first order. Optionally return RESULT.
  • Function MAPTREE (fn tree)
    Map a one-argument function FN over subtree of the TREE in depth-first order, returning a new tree with the same structure.
  • Function MAPLEAVES (fn tree)
    Map a one-argument function FN over each leaf node of the TREE in depth-first order, returning a new tree with the same structure.
  • Function TREE-SIZE (tree)
    Returns the number of nodes (internal & external) in the indicated TREE.
  • Function TREE-DEPTH (tree)
    Returns the length of the largest of nodes from the root tree.

RUTILS.ABBR

Abbreviations of some common utilities with long names.
  • Function IN# (key hash-table)
    Check if KEY is present in HASH-TABLE.
  • Macro FLET* (&rest body)
    An abbreviation for LABELS.

RUTILS

The whole set of utilities in one package.
No exported symbols.

Also exports

  • RUTILS.MISC:MORE
  • RUTILS.READTABLE:#/-reader
  • RUTILS.LIST:WITH-OUTPUT-TO-LIST
  • RUTILS.HASH-TABLE:DOTABLE
  • RUTILS.PAIR:PAIRS
  • RUTILS.TREE:DOTREE
  • RUTILS.ANAPHORA:COND-LET
  • RUTILS.READTABLE:%%
  • RUTILS.STRING:DOLINES
  • RUTILS.CORE:PACKAGE-INTERNAL-SYMBOLS
  • RUTILS.LIST:ZIP-WITH
  • RUTILS.ANAPHORA:AND-BIND
  • RUTILS.CORE:RUTILS-STYLE-WARNING
  • RUTILS.CORE:ABBR
  • RUTILS.MISC:DCASE
  • RUTILS.SEQUENCE:KEEP
  • RUTILS.STRING:READ-FILE
  • RUTILS.LIST:ENSURE-LIST
  • RUTILS.HASH-TABLE:TOGGLE-PRINT-HASH-TABLE
  • RUTILS.STRING:STARTS-WITH
  • RUTILS.ANAPHORA:ACOND
  • RUTILS.SEQUENCE:DOINDEX
  • RUTILS.LIST:DOPLIST
  • RUTILS.MISC:CSWITCH
  • RUTILS.SEQUENCE:ROTATE
  • RUTILS.MISC:CASE-FAILURE
  • RUTILS.LIST:NREVERSEF
  • RUTILS.SEQUENCE:EMPTYP
  • RUTILS.STRING:STRJOIN
  • RUTILS.ANAPHORA:DOWHILE-IT
  • RUTILS.ARRAY:VEC
  • RUTILS.READTABLE:#v-reader
  • RUTILS.SEQUENCE:SUM
  • RUTILS.MISC:MULTIPLE-VALUE-PROG2
  • RUTILS.TREE:TREE-SIZE
  • RUTILS.SEQUENCE:PRODUCT
  • RUTILS.READTABLE:#{-reader
  • RUTILS.STRING:BLANKP
  • RUTILS.READTABLE:#`-reader
  • RUTILS.MISC:RE-SETF
  • RUTILS.LIST:ATOMIZE
  • RUTILS.LIST:MAPPEND
  • RUTILS.LIST:UNIONF
  • RUTILS.LIST:REMOVE-IDX
  • RUTILS.ANAPHORA:IF-LET
  • RUTILS.MISC:PCCASE
  • RUTILS.LIST:APPENDF
  • RUTILS.ANAPHORA:WHEN-BIND
  • RUTILS.HASH-TABLE:WITH-KEYS
  • RUTILS.ANAPHORA:IT
  • RUTILS.SEQUENCE:SAFE-SORT
  • RUTILS.HASH-TABLE:COPY-HASH-TABLE
  • RUTILS.LIST:FLATTEN
  • RUTILS.CORE:ENSURE-KEYWORD
  • RUTILS.SEQUENCE:REMOVEF
  • RUTILS.LIST:DYADIC
  • RUTILS.ANAPHORA:WHEN-LET
  • RUTILS.LIST:DLISTP
  • RUTILS.ANAPHORA:AND-LET
  • RUTILS.SEQUENCE:GROUP
  • RUTILS.LIST:PLISTP
  • RUTILS.CORE:WITH-UNIQUE-NAMES
  • RUTILS.STRING:WHITE-CHAR-P
  • RUTILS.MISC:PECASE
  • RUTILS.ANAPHORA:DOWHILE-LET
  • RUTILS.STRING:LAST-CHAR
  • RUTILS.LIST:ALIST-TO-PLIST
  • RUTILS.SEQUENCE:DELETEF
  • RUTILS.LIST:SET-EQUAL
  • RUTILS.LIST:NCONCF
  • RUTILS.MISC:XOR
  • RUTILS.LIST:LAST1
  • RUTILS.HASH-TABLE:HASH-SET
  • RUTILS.LIST:SINGLE
  • RUTILS.HASH-TABLE:HASH-TABLE-VALS
  • RUTILS.PAIR:WITH-PAIR
  • RUTILS.LIST:NUNIONF
  • RUTILS.HASH-TABLE:HASH-TABLE-TO-ALIST
  • RUTILS.ANAPHORA:AWHEN
  • RUTILS.ANAPHORA:IF-BIND
  • RUTILS.PAIR:RT
  • RUTILS.MISC:XOR2
  • RUTILS.MISC:OR2
  • RUTILS.MISC:VOID
  • RUTILS.MISC:DCCASE
  • RUTILS.STRING:SPLIT-STRING
  • RUTILS.TREE:MAPLEAVES
  • RUTILS.LIST:PLIST-TO-ALIST
  • RUTILS.LIST:ASSOC1
  • RUTILS.CORE:PACKAGE-EXTERNAL-SYMBOLS
  • RUTILS.ANAPHORA:AIF
  • RUTILS.LIST:ZIP*-WITH
  • RUTILS.PAIR:MAKE-PAIR
  • RUTILS.MISC:NAMED-LAMBDA
  • RUTILS.SEQUENCE:MAP*
  • RUTILS.HASH-TABLE:HASH-TABLE-FROM-ALIST
  • RUTILS.LIST:DLIST
  • RUTILS.CORE:PACKAGE-SYMBOLS
  • RUTILS.SEQUENCE:SPLIT-SEQUENCE-IF-NOT
  • RUTILS.ARRAY:COPY-ARRAY
  • RUTILS.CORE:EVAL-ALWAYS
  • RUTILS.HASH-TABLE:PRINT-HASH-TABLE
  • RUTILS.ANAPHORA:ADOWHILE
  • RUTILS.ANAPHORA:DOWHILE-BIND
  • RUTILS.MISC:DECASE
  • RUTILS.SEQUENCE:NSHUFFLE
  • RUTILS.STRING:WITH-OUT-FILE
  • RUTILS.SEQUENCE:PARTITION-WITH
  • RUTILS.TREE:DOLEAVES
  • RUTILS.LIST:ZIP*
  • RUTILS.LIST:ALIST
  • RUTILS.ANAPHORA:AAND
  • RUTILS.READTABLE:+DEFAULT-OPTS+
  • RUTILS.HASH-TABLE:HASH-TABLE-TO-PLIST
  • RUTILS.ARRAY:ARRAY-INDEX
  • RUTILS.LIST:PERMUTATIONS
  • RUTILS.MISC:TRUE
  • RUTILS.HASH-TABLE:SETHASH
  • RUTILS.STRING:SLURP
  • RUTILS.ARRAY:SLICE
  • RUTILS.ANAPHORA:COND-IT
  • RUTILS.READTABLE:%
  • RUTILS.LIST:MAPINDEX
  • RUTILS.MISC:PCASE
  • RUTILS.STRING:SUBSTR
  • RUTILS.LIST:MAPTIMES
  • RUTILS.ANAPHORA:AND-IT
  • RUTILS.MISC:ONCE-ONLY
  • RUTILS.LIST:REVERSEF
  • RUTILS.PAIR:LT
  • RUTILS.MISC:SWITCH
  • RUTILS.MISC:2ND
  • RUTILS.HASH-TABLE:TAKEHASH
  • RUTILS.MISC:NOT-LESS
  • RUTILS.MISC:AND2
  • RUTILS.MISC:ESWITCH
  • RUTILS.ANAPHORA:IF-IT
  • RUTILS.READTABLE:#h-reader
  • RUTILS.ANAPHORA:WHEN-IT
  • RUTILS.SEQUENCE:LAST-ELT
  • RUTILS.PAIR:PAIRS->HT
  • RUTILS.LIST:ALISTP
  • RUTILS.ARRAY:DOVEC
  • RUTILS.LIST:TAKE
  • RUTILS.CORE:WITH-GENSYMS
  • RUTILS.CORE:ENSURE-SYMBOL
  • RUTILS.HASH-TABLE:HASH-TABLE-KEYS
  • RUTILS.LIST:RANGE
  • RUTILS.MISC:NOT-MORE
  • RUTILS.LIST:INTERPOSE
  • RUTILS.SEQUENCE:EQUAL-LENGTHS
  • RUTILS.LIST:REMOVE-FROM-PLIST
  • RUTILS.LIST:DCONS
  • RUTILS.LIST:DELETE-FROM-PLIST
  • RUTILS.STRING:FMT
  • RUTILS.HASH-TABLE:GETSETHASH
  • RUTILS.LIST:CONCAT
  • RUTILS.SEQUENCE:LENGTH=
  • RUTILS.LIST:INTERLEAVE
  • RUTILS.LIST:BUTLAST2
  • RUTILS.MISC:COERCEF
  • RUTILS.PAIR:HT->PAIRS
  • RUTILS.CORE:RE-EXPORT-SYMBOLS
  • RUTILS.STRING:STRING-DESIGNATOR
  • RUTILS.TREE:TREE-DEPTH
  • RUTILS.LIST:TRYADIC
  • RUTILS.LIST:LISTCASE
  • RUTILS.HASH-TABLE:HASH-TABLE-FROM-PLIST
  • RUTILS.ANAPHORA:COND-BIND
  • RUTILS.TREE:MAPTREE
  • RUTILS.HASH-TABLE:MERGE-HASH-TABLES
  • RUTILS.STRING:ENDS-WITH
  • RUTILS.SEQUENCE:SHUFFLE
  • RUTILS.SEQUENCE:SPLIT-SEQUENCE
  • RUTILS.READTABLE:RUTILS-READTABLE
  • RUTILS.SEQUENCE:SEQUENCE-OF-LENGTH
  • RUTILS.PAIR:PAIR
  • RUTILS.STRING:STRCAT
  • RUTILS.SEQUENCE:SPLIT-SEQUENCE-IF
  • RUTILS.MISC:LESS
  • RUTILS.CORE:MAKE-GENSYM-LIST
  • RUTILS.LIST:MAPCANINDEX
  • RUTILS.LIST:ZIP
  • RUTILS.ARRAY:ARRAY-LENGTH

RUTIL

The whole set of utilities + abbreviations in one package.
No exported symbols.

Also exports

  • RUTILS.MISC:MORE
  • RUTILS.ABBR:W/UNIQS
  • RUTILS.READTABLE:#/-reader
  • RUTILS.ABBR:SUB
  • RUTILS.SEQUENCE:EQUAL-LENGTHS
  • RUTILS.ABBR:MV-BIND
  • RUTILS.PAIR:PAIRS
  • RUTILS.TREE:DOTREE
  • RUTILS.ANAPHORA:COND-LET
  • RUTILS.READTABLE:%%
  • RUTILS.ABBR:HT-COUNT
  • RUTILS.CORE:PACKAGE-INTERNAL-SYMBOLS
  • RUTILS.LIST:ZIP-WITH
  • RUTILS.ANAPHORA:AND-BIND
  • RUTILS.ABBR:JUST
  • RUTILS.CORE:RUTILS-STYLE-WARNING
  • RUTILS.MISC:ESWITCH
  • RUTILS.ANAPHORA:DOWHILE-BIND
  • RUTILS.CORE:ABBR
  • RUTILS.MISC:DCASE
  • RUTILS.SEQUENCE:KEEP
  • RUTILS.ABBR:SET#
  • RUTILS.LIST:WITH-OUTPUT-TO-LIST
  • RUTILS.LIST:ENSURE-LIST
  • RUTILS.ABBR:P#
  • RUTILS.ANAPHORA:ACOND
  • RUTILS.LIST:MAPCANINDEX
  • RUTILS.SEQUENCE:DOINDEX
  • RUTILS.LIST:DOPLIST
  • RUTILS.HASH-TABLE:HASH-TABLE-FROM-PLIST
  • RUTILS.MISC:CASE-FAILURE
  • RUTILS.LIST:NREVERSEF
  • RUTILS.SEQUENCE:EMPTYP
  • RUTILS.ARRAY:SLICE
  • RUTILS.ANAPHORA:DOWHILE-IT
  • RUTILS.ARRAY:VEC
  • RUTILS.READTABLE:#v-reader
  • RUTILS.SEQUENCE:SUM
  • RUTILS.MISC:MULTIPLE-VALUE-PROG2
  • RUTILS.TREE:TREE-SIZE
  • RUTILS.ABBR:MKSYM
  • RUTILS.READTABLE:#{-reader
  • RUTILS.STRING:BLANKP
  • RUTILS.READTABLE:#`-reader
  • RUTILS.ABBR:IN#
  • RUTILS.MISC:RE-SETF
  • RUTILS.LIST:ATOMIZE
  • RUTILS.LIST:MAPPEND
  • RUTILS.LIST:UNIONF
  • RUTILS.LIST:REMOVE-IDX
  • RUTILS.ANAPHORA:IF-LET
  • RUTILS.MISC:PCCASE
  • RUTILS.LIST:APPENDF
  • RUTILS.ABBR:W/OUTSTR
  • RUTILS.LIST:REVERSEF
  • RUTILS.LIST:INTERPOSE
  • RUTILS.ANAPHORA:IT
  • RUTILS.SEQUENCE:SAFE-SORT
  • RUTILS.HASH-TABLE:COPY-HASH-TABLE
  • RUTILS.CORE:ENSURE-KEYWORD
  • RUTILS.SEQUENCE:REMOVEF
  • RUTILS.LIST:DYADIC
  • RUTILS.LIST:SINGLE
  • RUTILS.ANAPHORA:WHEN-LET
  • RUTILS.LIST:DLISTP
  • RUTILS.ANAPHORA:AND-LET
  • RUTILS.PAIR:PAIR
  • RUTILS.ABBR:DEFPAR
  • RUTILS.CORE:WITH-UNIQUE-NAMES
  • RUTILS.STRING:WHITE-CHAR-P
  • RUTILS.MISC:PECASE
  • RUTILS.ANAPHORA:DOWHILE-LET
  • RUTILS.LIST:ALIST-TO-PLIST
  • RUTILS.SEQUENCE:DELETEF
  • RUTILS.LIST:SET-EQUAL
  • RUTILS.LIST:NCONCF
  • RUTILS.ABBR:SPLIT
  • RUTILS.LIST:LAST1
  • RUTILS.MISC:XOR
  • RUTILS.HASH-TABLE:HASH-TABLE-VALS
  • RUTILS.ANAPHORA:IF-IT
  • RUTILS.LIST:NUNIONF
  • RUTILS.STRING:SPLIT-STRING
  • RUTILS.STRING:STARTS-WITH
  • RUTILS.ANAPHORA:IF-BIND
  • RUTILS.ABBR:MERGE-HTS
  • RUTILS.PAIR:RT
  • RUTILS.SEQUENCE:LAST-ELT
  • RUTILS.MISC:XOR2
  • RUTILS.ABBR:REM#
  • RUTILS.ABBR:ALIST->HT
  • RUTILS.ABBR:CALL
  • RUTILS.MISC:DCCASE
  • RUTILS.ABBR:HT-VALS
  • RUTILS.ANAPHORA:AWHEN
  • RUTILS.LIST:ASSOC1
  • RUTILS.ABBR:FN
  • RUTILS.STRING:FMT
  • RUTILS.STRING:STRJOIN
  • RUTILS.LIST:ZIP*-WITH
  • RUTILS.ABBR:KEEP-IF-NOT
  • RUTILS.LIST:BUTLAST2
  • RUTILS.STRING:STRCAT
  • RUTILS.MISC:NAMED-LAMBDA
  • RUTILS.LIST:TRYADIC
  • RUTILS.HASH-TABLE:HASH-TABLE-FROM-ALIST
  • RUTILS.STRING:LAST-CHAR
  • RUTILS.CORE:PACKAGE-SYMBOLS
  • RUTILS.STRING:DOLINES
  • RUTILS.ARRAY:COPY-ARRAY
  • RUTILS.CORE:EVAL-ALWAYS
  • RUTILS.HASH-TABLE:PRINT-HASH-TABLE
  • RUTILS.TREE:MAPLEAVES
  • RUTILS.SEQUENCE:SPLIT-SEQUENCE-IF-NOT
  • RUTILS.LIST:LISTCASE
  • RUTILS.MISC:DECASE
  • RUTILS.SEQUENCE:NSHUFFLE
  • RUTILS.STRING:WITH-OUT-FILE
  • RUTILS.SEQUENCE:SHUFFLE
  • RUTILS.HASH-TABLE:TOGGLE-PRINT-HASH-TABLE
  • RUTILS.ABBR:FLAT-MAP
  • RUTILS.ANAPHORA:COND-BIND
  • RUTILS.PAIR:MAKE-PAIR
  • RUTILS.LIST:ZIP*
  • RUTILS.ABBR:GETSET#
  • RUTILS.ANAPHORA:AAND
  • RUTILS.MISC:NOT-MORE
  • RUTILS.READTABLE:+DEFAULT-OPTS+
  • RUTILS.CORE:WITH-GENSYMS
  • RUTILS.HASH-TABLE:HASH-TABLE-TO-PLIST
  • RUTILS.TREE:DOLEAVES
  • RUTILS.MISC:TRUE
  • RUTILS.ANAPHORA:ADOWHILE
  • RUTILS.HASH-TABLE:SETHASH
  • RUTILS.STRING:ENDS-WITH
  • RUTILS.ARRAY:ARRAY-LENGTH
  • RUTILS.ABBR:M1
  • RUTILS.STRING:SLURP
  • RUTILS.ANAPHORA:COND-IT
  • RUTILS.LIST:FLATTEN
  • RUTILS.LIST:DLIST
  • RUTILS.MISC:PCASE
  • RUTILS.HASH-TABLE:DOTABLE
  • RUTILS.LIST:MAPTIMES
  • RUTILS.ANAPHORA:AND-IT
  • RUTILS.STRING:SUBSTR
  • RUTILS.MISC:CSWITCH
  • RUTILS.HASH-TABLE:HASH-SET
  • RUTILS.CORE:RE-EXPORT-SYMBOLS
  • RUTILS.SEQUENCE:SPLIT-SEQUENCE
  • RUTILS.MISC:OR2
  • RUTILS.MISC:SWITCH
  • RUTILS.ABBR:GET#
  • RUTILS.MISC:2ND
  • RUTILS.HASH-TABLE:TAKEHASH
  • RUTILS.LIST:DCONS
  • RUTILS.MISC:NOT-LESS
  • RUTILS.MISC:AND2
  • RUTILS.ABBR:MAKE
  • RUTILS.MISC:VOID
  • RUTILS.CORE:PACKAGE-EXTERNAL-SYMBOLS
  • RUTILS.ABBR:FILTER
  • RUTILS.READTABLE:#h-reader
  • RUTILS.ANAPHORA:WHEN-IT
  • RUTILS.ABBR:FLET*
  • RUTILS.PAIR:PAIRS->HT
  • RUTILS.LIST:ALISTP
  • RUTILS.ABBR:HT->PLIST
  • RUTILS.ARRAY:DOVEC
  • RUTILS.ANAPHORA:WHEN-BIND
  • RUTILS.SEQUENCE:PRODUCT
  • RUTILS.MISC:COERCEF
  • RUTILS.PAIR:HT->PAIRS
  • RUTILS.CORE:ENSURE-SYMBOL
  • RUTILS.HASH-TABLE:HASH-TABLE-KEYS
  • RUTILS.LIST:RANGE
  • RUTILS.HASH-TABLE:WITH-KEYS
  • RUTILS.STRING:STRING-DESIGNATOR
  • RUTILS.LIST:ALIST
  • RUTILS.LIST:PERMUTATIONS
  • RUTILS.LIST:MAPINDEX
  • RUTILS.ANAPHORA:AIF
  • RUTILS.LIST:DELETE-FROM-PLIST
  • RUTILS.SEQUENCE:GROUP
  • RUTILS.HASH-TABLE:GETSETHASH
  • RUTILS.LIST:CONCAT
  • RUTILS.SEQUENCE:LENGTH=
  • RUTILS.LIST:INTERLEAVE
  • RUTILS.ABBR:MKEYW
  • RUTILS.SEQUENCE:SPLIT-SEQUENCE-IF
  • RUTILS.SEQUENCE:ROTATE
  • RUTILS.SEQUENCE:PARTITION-WITH
  • RUTILS.PAIR:LT
  • RUTILS.LIST:TAKE
  • RUTILS.TREE:TREE-DEPTH
  • RUTILS.ABBR:DS-BIND
  • RUTILS.ABBR:PLIST->HT
  • RUTILS.ABBR:SPLIT-IF
  • RUTILS.READTABLE:RUTILS-READTABLE
  • RUTILS.ABBR:MKLIST
  • RUTILS.LIST:PLISTP
  • RUTILS.ABBR:KEEP-IF
  • RUTILS.TREE:MAPTREE
  • RUTILS.HASH-TABLE:MERGE-HASH-TABLES
  • RUTILS.MISC:ONCE-ONLY
  • RUTILS.ABBR:HT->ALIST
  • RUTILS.ABBR:MAPCAT
  • RUTILS.ARRAY:ARRAY-INDEX
  • RUTILS.CORE:MAKE-GENSYM-LIST
  • RUTILS.ABBR:SPLIT-IF-NOT
  • RUTILS.STRING:READ-FILE
  • RUTILS.SEQUENCE:SEQUENCE-OF-LENGTH
  • RUTILS.MISC:LESS
  • RUTILS.ABBR:HT-KEYS
  • RUTILS.LIST:PLIST-TO-ALIST
  • RUTILS.READTABLE:%
  • RUTILS.SEQUENCE:MAP*
  • RUTILS.ABBR:PRINT-HT
  • RUTILS.ABBR:W/INSTR
  • RUTILS.PAIR:WITH-PAIR
  • RUTILS.HASH-TABLE:HASH-TABLE-TO-ALIST
  • RUTILS.ABBR:TAKE#
  • RUTILS.LIST:ZIP
  • RUTILS.LIST:REMOVE-FROM-PLIST

rutils-test

A test suite for RUTILS built with SHOULD-TEST library.

RUTILS.TEST

Test package for RUTILS.
  • Function RUN-TESTS

rutilsx

The most radical utilities.

RUTILSX.GENERATORS

Python-like generators (yield) support.
  • Condition GENERATED
  • Function YIELD (&optional item)
    Signal an ITEM from the generator with a possibility to resume computation.
  • Function YIELD-TO (generator item)
    Pass contol to other GENERATOR and submit ITEM that will be returned from the call to yield in it.
  • Macro FORCE (generator-form)
    Return the results of GENERATOR-FORM work as a list of items.
  • Macro DOING ((item generator-form &optional result) &body body)
    Like DOLIST but for iterating GENERATOR-FORM.

RUTILSX.GENERIC

Generic access to pairs, sequences and tables.
  • Generic-Function SMART-SLOT-VALUE (obj slot)
    Similar to SLOT-VALUE but tries to find slot definitions regardless of the package.
  • Method SMART-SLOT-VALUE (obj slot)
  • Method SMART-SLOT-VALUE (obj slot)
  • Method SMART-SLOT-VALUE (obj slot)
  • Generic-Function GENERIC-ELT (obj key &rest keys)
    Generic element access in OBJ by KEY. Supports chaining with KEYS.
  • Method GENERIC-ELT (obj key &rest keys)
  • Method GENERIC-ELT (obj key &rest keys)
  • Method GENERIC-ELT (obj key &rest keys)
  • Method GENERIC-ELT (obj key &rest keys)
  • Method GENERIC-ELT ((obj list) key &rest keys)
  • Method GENERIC-ELT ((obj vector) key &rest keys)
  • Method GENERIC-ELT ((obj array) (key list) &rest keys)
  • Method GENERIC-ELT ((obj sequence) key &rest keys)
  • Method GENERIC-ELT ((obj hash-table) key &rest keys)
  • Method GENERIC-ELT ((obj structure-object) key &rest keys)
  • Method GENERIC-ELT ((obj standard-object) key &rest keys)
  • Method GENERIC-ELT ((obj (eql nil)) key &rest keys)
  • Generic-Function KEYS (table)
    Return a list of all keys in a TABLE. Order is unspecified.
  • Method KEYS ((list list))
  • Method KEYS ((list list))
  • Method KEYS ((list list))
  • Method KEYS ((table hash-table))
  • Method KEYS ((table hash-table))
  • Method KEYS ((table hash-table))
  • Generic-Function VALS (table)
    Return a list of all values in a TABLE. Order is unspecified.
  • Method VALS ((list list))
  • Method VALS ((list list))
  • Method VALS ((list list))
  • Method VALS ((table hash-table))
  • Method VALS ((table hash-table))
  • Method VALS ((table hash-table))
  • Generic-Function KVS (table &optional result-kind)
    Return a list of all key-value pairs in a TABLE in one the 3 kinds: - list of pairs (default) - alist - dlist Order is unspecified.
  • Method KVS ((table hash-table) &optional (result-kind 'pairs))
  • Method KVS ((table hash-table) &optional (result-kind 'pairs))
  • Method KVS ((table hash-table) &optional (result-kind 'pairs))
  • Generic-Function EQ-TEST (table)
    Return an equality test predicate of the TABLE.
  • Method EQ-TEST ((list list))
  • Method EQ-TEST ((list list))
  • Method EQ-TEST ((list list))
  • Method EQ-TEST ((table hash-table))
  • Method EQ-TEST ((table hash-table))
  • Method EQ-TEST ((table hash-table))
  • Generic-Function MAPTAB (fn table)
    Like MAPCAR but for a data structure that can be viewed as a table.
  • Method MAPTAB (fn (list list))
  • Method MAPTAB (fn (list list))
  • Method MAPTAB (fn (list list))
  • Method MAPTAB (fn (table hash-table))
  • Method MAPTAB (fn (table hash-table))
  • Method MAPTAB (fn (table hash-table))
  • Generic-Function COPY (obj)
    Create a shallow copy of an object.
  • Method COPY ((obj structure-object))
  • Method COPY ((obj structure-object))
  • Method COPY ((obj structure-object))
  • Method COPY ((obj hash-table))
  • Method COPY ((obj hash-table))
  • Method COPY ((obj hash-table))
  • Method COPY ((obj sequence))
  • Method COPY ((obj sequence))
  • Method COPY ((obj sequence))
  • Method COPY ((obj list))
  • Method COPY ((obj list))
  • Method COPY ((obj list))

Also exports

  • RUTILS.PAIR:PAIRS

RUTILSX.ITER

Iterate macro with keywords for clauses.
  • Variable ITER-VERSION
    "1.4.3"
    Current version of Iterate.
  • Macro ITER (&body body &environment env)
    Jonathan Amsterdam's powerful and extensible iteration facility, providing multiple accumulation, generators, memory of previous iterations, over 50 clauses to start with and a Lisp-like syntax. Evaluate (iter:display-iter-clauses) for an overview of clauses.
  • Function DISPLAY-ITER-CLAUSES (&optional clause-spec)
    Display ITERATE clause.
  • Macro DEFMACRO-CLAUSE (clause-template &body body)
    Macro for defining iterate clauses (with DEFMACRO).
  • Macro DEFCLAUSE (clause-template &body body)
    Macro for defining iterate clauses (with DEFUN).
  • Macro DEFMACRO-DRIVER (clause-template &body body)
    Macro for for defining iterators (with DEFMACRO), which may also be used as generators.
  • Macro DEFCLAUSE-DRIVER (clause-template &body body)
    Macro for for defining (with DEFUN) iterators, which may also be used as generators.
  • Macro DEFCLAUSE-SEQUENCE (element-name index-name &key access-fn size-fn element-type sequence-type element-doc-string index-doc-string)
    A simple way to define a FOR-like &sequence clause.
  • Macro DSETQ (template value)
    Destructuring assignment; supports both (VALUES ...) for destructuring a multiple-value form and NIL as a variable name, meaning to ignore that position, e.g. (DSETQ (VALUES (A . B) NIL C) FORM).

RUTILSX.BIND

Unified extensible bind operator.
  • Macro BIND ((&rest bindings) &body body)
    Bind variables from BINDINGS to be active inside BODY, as if by LET*, combined with MULTIPLE-VALUE-BIND, DESTRUCTURING-BIND and other -bind forms, depending on the type of the first argument.
  • Generic-Function BIND-DISPATCH (arg1 arg2 &rest args)
  • Method BIND-DISPATCH ((arg1 list) arg2 &rest args)
  • Method BIND-DISPATCH ((arg1 list) arg2 &rest args)
  • Method BIND-DISPATCH ((arg1 list) arg2 &rest args)
  • Method BIND-DISPATCH ((arg1 list) (arg2 (eql '@)) &rest args)
  • Method BIND-DISPATCH ((arg1 list) (arg2 (eql '@)) &rest args)
  • Method BIND-DISPATCH ((arg1 list) (arg2 (eql '@)) &rest args)
  • Method BIND-DISPATCH ((arg1 list) (arg2 (eql '?)) &rest args)
  • Method BIND-DISPATCH ((arg1 list) (arg2 (eql '?)) &rest args)
  • Method BIND-DISPATCH ((arg1 list) (arg2 (eql '?)) &rest args)
  • Method BIND-DISPATCH ((arg1 symbol) arg2 &rest args)
  • Method BIND-DISPATCH ((arg1 symbol) arg2 &rest args)
  • Method BIND-DISPATCH ((arg1 symbol) arg2 &rest args)

RUTILSX.THREADING

Clojure-like threading macros.
  • Macro -> (x &rest forms)
    Threads the expr through FORMS. Inserts X as the second item in the first form, or in place of % if it is present in the form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the second item in second form, etc.
  • Macro ->> (x &rest forms)
    Threads the expr through FORMS. Inserts X as the last item in the first form, or in place of % if it is present in the form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the second item in second form, etc.
  • Macro => (fn1 fn2 &rest fns)
    Function composition of FN1, FN2 and all the other FNS.

RUTILSX.READTABLE

Additional reader syntax support.
No exported symbols.

RUTILSX

The whole set of utilities in one package.
No exported symbols.

Also exports

  • RUTILS.HASH-TABLE:TAKEHASH
  • RUTILS.SEQUENCE:SUM
  • RUTILS.MISC:XOR2
  • RUTILS.LIST:SET-EQUAL
  • RUTILS.LIST:UNIONF
  • RUTILS.PAIR:WITH-PAIR
  • RUTILS.CORE:PACKAGE-INTERNAL-SYMBOLS
  • RUTILSX.GENERIC:MAPTAB
  • RUTILS.ABBR:M1
  • RUTILS.STRING:STARTS-WITH
  • RUTILSX.BIND:BIND
  • RUTILS.ABBR:HT-VALS
  • RUTILS.STRING:STRCAT
  • RUTILS.HASH-TABLE:TOGGLE-PRINT-HASH-TABLE
  • RUTILS.MISC:MULTIPLE-VALUE-PROG2
  • RUTILS.STRING:SUBSTR
  • RUTILS.ANAPHORA:ACOND
  • RUTILS.HASH-TABLE:GETSETHASH
  • RUTILS.ABBR:FLAT-MAP
  • RUTILS.TREE:TREE-DEPTH
  • RUTILSX.ITER:DEFCLAUSE-DRIVER
  • RUTILS.MISC:NOT-LESS
  • RUTILS.LIST:MAPINDEX
  • RUTILS.HASH-TABLE:HASH-TABLE-KEYS
  • RUTILS.HASH-TABLE:WITH-KEYS
  • RUTILS.HASH-TABLE:HASH-TABLE-TO-PLIST
  • RUTILS.CORE:ABBR
  • RUTILS.ARRAY:SLICE
  • RUTILS.LIST:DLISTP
  • RUTILS.MISC:ESWITCH
  • RUTILSX.BIND:WITH
  • RUTILS.MISC:LESS
  • RUTILS.ANAPHORA:DOWHILE-IT
  • RUTILS.ABBR:HT-COUNT
  • RUTILS.PAIR:PAIRS->HT
  • RUTILS.ABBR:TAKE#
  • RUTILS.ARRAY:COPY-ARRAY
  • RUTILS.READTABLE:RUTILS-READTABLE
  • RUTILS.MISC:RE-SETF
  • RUTILS.READTABLE:%
  • RUTILS.SEQUENCE:SPLIT-SEQUENCE-IF
  • RUTILSX.GENERIC:SMART-SLOT-VALUE
  • RUTILS.LIST:REMOVE-IDX
  • RUTILS.ARRAY:ARRAY-INDEX
  • RUTILS.ABBR:GETSET#
  • RUTILS.MISC:SWITCH
  • RUTILS.MISC:VOID
  • RUTILS.LIST:BUTLAST2
  • RUTILS.ABBR:HT->PLIST
  • RUTILS.ABBR:JUST
  • RUTILS.MISC:DECASE
  • RUTILS.MISC:NAMED-LAMBDA
  • RUTILS.SEQUENCE:LENGTH=
  • RUTILS.ABBR:FLET*
  • RUTILS.ARRAY:VEC
  • RUTILS.STRING:SLURP
  • RUTILS.PAIR:LT
  • RUTILS.LIST:ZIP*
  • RUTILS.CORE:MAKE-GENSYM-LIST
  • RUTILSX.GENERATORS:YIELD
  • RUTILS.SEQUENCE:SEQUENCE-OF-LENGTH
  • RUTILS.ABBR:SPLIT-IF-NOT
  • RUTILS.ABBR:W/OUTSTR
  • RUTILS.LIST:SINGLE
  • RUTILS.HASH-TABLE:COPY-HASH-TABLE
  • RUTILSX.GENERIC:EQ-TEST
  • RUTILS.LIST:WITH-OUTPUT-TO-LIST
  • RUTILS.ABBR:W/UNIQS
  • RUTILS.LIST:TAKE
  • RUTILS.ANAPHORA:AND-IT
  • RUTILS.READTABLE:#v-reader
  • RUTILS.STRING:FMT
  • RUTILS.LIST:DOPLIST
  • RUTILS.ANAPHORA:DOWHILE-BIND
  • RUTILS.CORE:WITH-GENSYMS
  • RUTILS.MISC:MORE
  • RUTILS.ANAPHORA:AIF
  • RUTILS.ABBR:HT->ALIST
  • RUTILS.ANAPHORA:AWHEN
  • RUTILS.MISC:PCCASE
  • RUTILS.HASH-TABLE:HASH-TABLE-VALS
  • RUTILS.HASH-TABLE:MERGE-HASH-TABLES
  • RUTILS.ABBR:MAKE
  • RUTILS.ANAPHORA:AAND
  • RUTILSX.ITER:DISPLAY-ITER-CLAUSES
  • RUTILS.LIST:NREVERSEF
  • RUTILS.LIST:LAST1
  • RUTILS.MISC:PCASE
  • RUTILS.LIST:INTERPOSE
  • RUTILS.LIST:LISTCASE
  • RUTILS.SEQUENCE:SPLIT-SEQUENCE
  • RUTILS.ABBR:MKEYW
  • RUTILS.SEQUENCE:NSHUFFLE
  • RUTILS.HASH-TABLE:HASH-SET
  • RUTILS.ABBR:REM#
  • RUTILS.LIST:APPENDF
  • RUTILS.MISC:NOT-MORE
  • RUTILS.ABBR:MAPCAT
  • RUTILS.PAIR:PAIR
  • RUTILS.LIST:ENSURE-LIST
  • RUTILS.LIST:MAPPEND
  • RUTILS.READTABLE:#/-reader
  • RUTILS.ANAPHORA:COND-LET
  • RUTILS.LIST:ALISTP
  • RUTILS.SEQUENCE:REMOVEF
  • RUTILS.MISC:DCASE
  • RUTILS.ANAPHORA:DOWHILE-LET
  • RUTILS.SEQUENCE:KEEP
  • RUTILSX.GENERIC:GENERIC-ELT
  • RUTILS.LIST:ALIST-TO-PLIST
  • RUTILS.MISC:CSWITCH
  • RUTILS.STRING:BLANKP
  • RUTILS.SEQUENCE:EQUAL-LENGTHS
  • RUTILS.READTABLE:%%
  • RUTILSX.GENERIC:VALS
  • RUTILS.TREE:DOLEAVES
  • RUTILS.ABBR:MKSYM
  • RUTILS.ANAPHORA:COND-IT
  • RUTILS.TREE:MAPLEAVES
  • RUTILSX.BIND:BIND-DISPATCH
  • RUTILSX.THREADING:->>
  • RUTILS.MISC:2ND
  • RUTILS.CORE:WITH-UNIQUE-NAMES
  • RUTILSX.ITER:DEFMACRO-DRIVER
  • RUTILSX.GENERATORS:FORCE
  • RUTILS.PAIR:MAKE-PAIR
  • RUTILS.HASH-TABLE:HASH-TABLE-FROM-PLIST
  • RUTILS.LIST:DYADIC
  • RUTILS.LIST:FLATTEN
  • RUTILS.ANAPHORA:WHEN-IT
  • RUTILS.ABBR:DS-BIND
  • RUTILS.MISC:PECASE
  • RUTILS.MISC:XOR
  • RUTILS.SEQUENCE:SHUFFLE
  • RUTILS.ABBR:CALL
  • RUTILSX.ITER:DEFCLAUSE-SEQUENCE
  • RUTILS.ANAPHORA:IF-IT
  • RUTILSX.ITER:DEFMACRO-CLAUSE
  • RUTILSX.ITER:DEFCLAUSE
  • RUTILSX.GENERATORS:GENERATED-ITEM
  • RUTILS.ABBR:W/INSTR
  • RUTILS.READTABLE:#h-reader
  • RUTILS.LIST:ZIP
  • RUTILSX.GENERATORS:GENERATED
  • RUTILS.LIST:RANGE
  • RUTILS.LIST:TRYADIC
  • RUTILS.LIST:ATOMIZE
  • RUTILS.SEQUENCE:GROUP
  • RUTILS.ABBR:SUB
  • RUTILS.MISC:TRUE
  • RUTILS.ABBR:HT-KEYS
  • RUTILS.STRING:STRJOIN
  • RUTILS.LIST:DCONS
  • RUTILS.STRING:STRING-DESIGNATOR
  • RUTILSX.GENERIC:?
  • RUTILSX.GENERATORS:DOING
  • RUTILS.ABBR:MV-BIND
  • RUTILS.READTABLE:+DEFAULT-OPTS+
  • RUTILS.LIST:DLIST
  • RUTILS.ABBR:SPLIT
  • RUTILS.ABBR:PLIST->HT
  • RUTILS.MISC:AND2
  • RUTILS.MISC:ONCE-ONLY
  • RUTILS.ABBR:GET#
  • RUTILSX.ITER:DECLARE-VARIABLES
  • RUTILS.STRING:READ-FILE
  • RUTILS.STRING:SPLIT-STRING
  • RUTILS.ANAPHORA:ADOWHILE
  • RUTILS.ANAPHORA:AND-BIND
  • RUTILS.LIST:ZIP*-WITH
  • RUTILS.ANAPHORA:IF-LET
  • RUTILSX.ITER:ITER-VERSION
  • RUTILS.HASH-TABLE:DOTABLE
  • RUTILSX.GENERIC:KEYS
  • RUTILS.LIST:NCONCF
  • RUTILS.ABBR:P#
  • RUTILS.ABBR:KEEP-IF
  • RUTILS.MISC:COERCEF
  • RUTILS.CORE:ENSURE-SYMBOL
  • RUTILS.TREE:TREE-SIZE
  • RUTILS.PAIR:PAIRS
  • RUTILS.CORE:PACKAGE-EXTERNAL-SYMBOLS
  • RUTILS.SEQUENCE:EMPTYP
  • RUTILS.STRING:WHITE-CHAR-P
  • RUTILS.STRING:ENDS-WITH
  • RUTILS.SEQUENCE:SAFE-SORT
  • RUTILS.ABBR:KEEP-IF-NOT
  • RUTILS.MISC:OR2
  • RUTILSX.THREADING:=>
  • RUTILS.CORE:RUTILS-STYLE-WARNING
  • RUTILS.SEQUENCE:DELETEF
  • RUTILS.ANAPHORA:IF-BIND
  • RUTILS.CORE:RE-EXPORT-SYMBOLS
  • RUTILS.LIST:CONCAT
  • RUTILS.STRING:DOLINES
  • RUTILSX.GENERATORS:YIELD-TO
  • RUTILS.HASH-TABLE:SETHASH
  • RUTILS.HASH-TABLE:HASH-TABLE-FROM-ALIST
  • RUTILS.HASH-TABLE:HASH-TABLE-TO-ALIST
  • RUTILS.SEQUENCE:DOINDEX
  • RUTILS.CORE:EVAL-ALWAYS
  • RUTILSX.BIND:_
  • RUTILS.ABBR:MKLIST
  • RUTILS.ABBR:FILTER
  • RUTILS.STRING:LAST-CHAR
  • RUTILS.READTABLE:#`-reader
  • RUTILS.SEQUENCE:PRODUCT
  • RUTILS.LIST:REMOVE-FROM-PLIST
  • RUTILS.SEQUENCE:MAP*
  • RUTILS.LIST:ZIP-WITH
  • RUTILS.STRING:WITH-OUT-FILE
  • RUTILS.TREE:MAPTREE
  • RUTILS.HASH-TABLE:PRINT-HASH-TABLE
  • RUTILS.ANAPHORA:WHEN-LET
  • RUTILSX.GENERIC:COPY
  • RUTILS.LIST:NUNIONF
  • RUTILS.SEQUENCE:PARTITION-WITH
  • RUTILS.LIST:PLISTP
  • RUTILS.PAIR:HT->PAIRS
  • RUTILS.LIST:DELETE-FROM-PLIST
  • RUTILSX.ITER:ITER
  • RUTILS.LIST:MAPTIMES
  • RUTILS.ABBR:FN
  • RUTILS.LIST:PERMUTATIONS
  • RUTILSX.ITER:DSETQ
  • RUTILSX.READTABLE:RUTILSX-READTABLE
  • RUTILS.ABBR:PRINT-HT
  • RUTILS.READTABLE:#{-reader
  • RUTILS.PAIR:RT
  • RUTILS.LIST:ALIST
  • RUTILSX.THREADING:->
  • RUTILS.LIST:PLIST-TO-ALIST
  • RUTILS.SEQUENCE:SPLIT-SEQUENCE-IF-NOT
  • RUTILS.ANAPHORA:IT
  • RUTILS.ABBR:DEFPAR
  • RUTILS.MISC:DCCASE
  • RUTILS.LIST:REVERSEF
  • RUTILS.LIST:INTERLEAVE
  • RUTILS.LIST:ASSOC1
  • RUTILSX.BIND:@
  • RUTILS.SEQUENCE:LAST-ELT
  • RUTILS.LIST:MAPCANINDEX
  • RUTILS.ABBR:IN#
  • RUTILSX.GENERIC:KVS
  • RUTILS.ANAPHORA:AND-LET
  • RUTILS.CORE:ENSURE-KEYWORD
  • RUTILS.ABBR:SET#
  • RUTILS.TREE:DOTREE
  • RUTILS.MISC:CASE-FAILURE
  • RUTILS.SEQUENCE:ROTATE
  • RUTILS.ABBR:ALIST->HT
  • RUTILS.ARRAY:ARRAY-LENGTH
  • RUTILS.ABBR:MERGE-HTS
  • RUTILS.ANAPHORA:COND-BIND
  • RUTILS.ANAPHORA:WHEN-BIND
  • RUTILS.CORE:PACKAGE-SYMBOLS
  • RUTILS.ABBR:SPLIT-IF
  • RUTILS.ARRAY:DOVEC