diff --git a/elpa/dash-20210116.1426/dash-autoloads.el b/elpa/dash-20210330.1544/dash-autoloads.el similarity index 94% rename from elpa/dash-20210116.1426/dash-autoloads.el rename to elpa/dash-20210330.1544/dash-autoloads.el index dfb56b0..3a96693 100644 --- a/elpa/dash-20210116.1426/dash-autoloads.el +++ b/elpa/dash-20210330.1544/dash-autoloads.el @@ -57,7 +57,7 @@ See `dash-fontify-mode' for more information on Dash-Fontify mode. Register the Dash Info manual with `info-lookup-symbol'. This allows Dash symbols to be looked up with \\[info-lookup-symbol]." t nil) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "dash" '("!cdr" "!cons" "--" "->" "-a" "-butlast" "-c" "-d" "-e" "-f" "-gr" "-i" "-keep" "-l" "-m" "-non" "-only-some" "-p" "-r" "-s" "-t" "-u" "-value-to-list" "-when-let" "-zip" "dash-"))) +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "dash" '("!cdr" "!cons" "--" "->" "-a" "-butlast" "-c" "-d" "-e" "-f" "-gr" "-i" "-juxt" "-keep" "-l" "-m" "-no" "-o" "-p" "-r" "-s" "-t" "-u" "-value-to-list" "-when-let" "-zip" "dash-"))) ;;;*** diff --git a/elpa/dash-20210116.1426/dash-pkg.el b/elpa/dash-20210330.1544/dash-pkg.el similarity index 67% rename from elpa/dash-20210116.1426/dash-pkg.el rename to elpa/dash-20210330.1544/dash-pkg.el index 8038c58..92d619a 100644 --- a/elpa/dash-20210116.1426/dash-pkg.el +++ b/elpa/dash-20210330.1544/dash-pkg.el @@ -1,6 +1,6 @@ -(define-package "dash" "20210116.1426" "A modern list library for Emacs" +(define-package "dash" "20210330.1544" "A modern list library for Emacs" '((emacs "24")) - :commit "4fb9613314f4ea07b1f6965799bd4a044703accd" :authors + :commit "b9286a84975874b10493f1cb4ea051c501f51273" :authors '(("Magnar Sveen" . "magnars@gmail.com")) :maintainer '("Magnar Sveen" . "magnars@gmail.com") diff --git a/elpa/dash-20210116.1426/dash.el b/elpa/dash-20210330.1544/dash.el similarity index 90% rename from elpa/dash-20210116.1426/dash.el rename to elpa/dash-20210330.1544/dash.el index edbb357..af22ef9 100644 --- a/elpa/dash-20210116.1426/dash.el +++ b/elpa/dash-20210330.1544/dash.el @@ -3,7 +3,7 @@ ;; Copyright (C) 2012-2021 Free Software Foundation, Inc. ;; Author: Magnar Sveen -;; Version: 2.17.0 +;; Version: 2.18.1 ;; Package-Requires: ((emacs "24")) ;; Keywords: extensions, lisp ;; Homepage: https://github.com/magnars/dash.el @@ -68,8 +68,11 @@ This is the anaphoric counterpart to `-each'." (defun -each (list fn) "Call FN on each element of LIST. Return nil; this function is intended for side effects. -Its anaphoric counterpart is `--each'. For access to the current -element's index in LIST, see `-each-indexed'." + +Its anaphoric counterpart is `--each'. + +For access to the current element's index in LIST, see +`-each-indexed'." (declare (indent 1)) (ignore (mapc fn list))) @@ -79,6 +82,7 @@ element's index in LIST, see `-each-indexed'." "Call FN on each index and element of LIST. For each ITEM at INDEX in LIST, call (funcall FN INDEX ITEM). Return nil; this function is intended for side effects. + See also: `-map-indexed'." (declare (indent 1)) (--each list (funcall fn it-index it))) @@ -107,6 +111,7 @@ This is the anaphoric counterpart to `-each-while'." Once an ITEM is reached for which PRED returns nil, FN is no longer called. Return nil; this function is intended for side effects. + Its anaphoric counterpart is `--each-while'." (declare (indent 2)) (--each-while list (funcall pred it) (funcall fn it))) @@ -136,6 +141,7 @@ This is the anaphoric counterpart to `-each-r'." (defun -each-r (list fn) "Call FN on each element of LIST in reversed order. Return nil; this function is intended for side effects. + Its anaphoric counterpart is `--each-r'." (--each-r list (funcall fn it))) @@ -167,6 +173,7 @@ This is the anaphoric counterpart to `-each-r-while'." Once an ITEM is reached for which PRED returns nil, FN is no longer called. Return nil; this function is intended for side effects. + Its anaphoric counterpart is `--each-r-while'." (--each-r-while list (funcall pred it) (funcall fn it))) @@ -192,19 +199,21 @@ This is the anaphoric counterpart to `-dotimes'." FN is called with a single argument on successive integers running from 0, inclusive, to NUM, exclusive. FN is not called if NUM is less than 1. + This function's anaphoric counterpart is `--dotimes'." (declare (indent 1)) (--dotimes num (funcall fn it))) (defun -map (fn list) "Apply FN to each item in LIST and return the list of results. + This function's anaphoric counterpart is `--map'." (mapcar fn list)) (defmacro --map (form list) "Eval FORM for each item in LIST and return the list of results. Each element of LIST in turn is bound to `it' before evaluating -BODY. +FORM. This is the anaphoric counterpart to `-map'." (declare (debug (def-form form))) `(mapcar (lambda (it) (ignore it) ,form) ,list)) @@ -232,6 +241,7 @@ LIST, then applying FN to that result and the second element, etc. If LIST is empty, return INIT without calling FN. This function's anaphoric counterpart is `--reduce-from'. + For other folds, see also `-reduce' and `-reduce-r'." (--reduce-from (funcall fn acc it) init list)) @@ -247,7 +257,9 @@ This is the anaphoric counterpart to `-reduce'." `(let ((,lv ,list)) (if ,lv (--reduce-from ,form (car ,lv) (cdr ,lv)) - (let (acc it) + ;; Explicit nil binding pacifies lexical "variable left uninitialized" + ;; warning. See issue #377 and upstream https://bugs.gnu.org/47080. + (let ((acc nil) (it nil)) (ignore acc it) ,form))))) @@ -260,6 +272,7 @@ If LIST is empty, return the result of calling FN with no arguments. This function's anaphoric counterpart is `--reduce'. + For other folds, see also `-reduce-from' and `-reduce-r'." (if list (-reduce-from fn (car list) (cdr list)) @@ -290,6 +303,7 @@ is like replacing the conses in LIST with applications of FN, and its last link with INIT, and evaluating the resulting expression. This function's anaphoric counterpart is `--reduce-r-from'. + For other folds, see also `-reduce-r' and `-reduce'." (--reduce-r-from (funcall fn it acc) init list)) @@ -318,6 +332,7 @@ like replacing the conses in LIST with applications of FN, ignoring its last link, and evaluating the resulting expression. This function's anaphoric counterpart is `--reduce-r'. + For other folds, see also `-reduce-r-from' and `-reduce'." (if list (--reduce-r (funcall fn it acc) list) @@ -340,7 +355,9 @@ This is the anaphoric counterpart to `-reductions-from'." That is, a list of the intermediate values of the accumulator when `-reduce-from' (which see) is called with the same arguments. + This function's anaphoric counterpart is `--reductions-from'. + For other folds, see also `-reductions' and `-reductions-r'." (--reductions-from (funcall fn acc it) init list)) @@ -362,7 +379,9 @@ This is the anaphoric counterpart to `-reductions'." "Return a list of FN's intermediate reductions across LIST. That is, a list of the intermediate values of the accumulator when `-reduce' (which see) is called with the same arguments. + This function's anaphoric counterpart is `--reductions'. + For other folds, see also `-reductions' and `-reductions-r'." (if list (--reductions-from (funcall fn acc it) (car list) (cdr list)) @@ -384,7 +403,9 @@ This is the anaphoric counterpart to `-reductions-r-from'." That is, a list of the intermediate values of the accumulator when `-reduce-r-from' (which see) is called with the same arguments. + This function's anaphoric counterpart is `--reductions-r-from'. + For other folds, see also `-reductions' and `-reductions-r'." (--reductions-r-from (funcall fn it acc) init list)) @@ -400,7 +421,9 @@ This is the anaphoric counterpart to `-reductions-r'." (--reduce-from (cons (let ((acc (car acc))) (ignore acc) ,form) acc) (list (car ,lv)) (cdr ,lv)) - (let (acc it) + ;; Explicit nil binding pacifies lexical "variable left uninitialized" + ;; warning. See issue #377 and upstream https://bugs.gnu.org/47080. + (let ((acc nil) (it nil)) (ignore acc it) (list ,form)))))) @@ -408,7 +431,9 @@ This is the anaphoric counterpart to `-reductions-r'." "Return a list of FN's intermediate reductions across reversed LIST. That is, a list of the intermediate values of the accumulator when `-reduce-r' (which see) is called with the same arguments. + This function's anaphoric counterpart is `--reductions-r'. + For other folds, see also `-reductions-r-from' and `-reductions'." (if list @@ -429,8 +454,11 @@ For the opposite operation, see also `--remove'." (defun -filter (pred list) "Return a new list of the items in LIST for which PRED returns non-nil. + Alias: `-select'. -This function's anaphoric counterpart `--filter'. + +This function's anaphoric counterpart is `--filter'. + For similar operations, see also `-keep' and `-remove'." (--filter (funcall pred it) list)) @@ -448,8 +476,11 @@ For the opposite operation, see also `--filter'." (defun -remove (pred list) "Return a new list of the items in LIST for which PRED returns nil. + Alias: `-reject'. -This function's anaphoric counterpart `--remove'. + +This function's anaphoric counterpart is `--remove'. + For similar operations, see also `-keep' and `-filter'." (--remove (funcall pred it) list)) @@ -480,72 +511,95 @@ This is a non-destructive operation, but only the front of LIST leading up to the removed item is a copy; the rest is LIST's original tail. If no item is removed, then the result is a complete copy. + Alias: `-reject-first'. + This function's anaphoric counterpart is `--remove-first'. + See also `-map-first', `-remove-item', and `-remove-last'." (--remove-first (funcall pred it) list)) (defalias '-reject-first '-remove-first) (defalias '--reject-first '--remove-first) -(defun -remove-last (pred list) - "Return a new list with the last item matching PRED removed. - -Alias: `-reject-last' - -See also: `-remove', `-map-last'" - (nreverse (-remove-first pred (reverse list)))) - (defmacro --remove-last (form list) - "Anaphoric form of `-remove-last'." + "Remove the last item from LIST for which FORM evals to non-nil. +Each element of LIST in turn is bound to `it' before evaluating +FORM. The result is a copy of LIST regardless of whether an +element is removed. +This is the anaphoric counterpart to `-remove-last'." (declare (debug (form form))) - `(-remove-last (lambda (it) ,form) ,list)) + `(nreverse (--remove-first ,form (reverse ,list)))) + +(defun -remove-last (pred list) + "Remove the last item from LIST for which PRED returns non-nil. +The result is a copy of LIST regardless of whether an element is +removed. + +Alias: `-reject-last'. + +This function's anaphoric counterpart is `--remove-last'. + +See also `-map-last', `-remove-item', and `-remove-first'." + (--remove-last (funcall pred it) list)) (defalias '-reject-last '-remove-last) (defalias '--reject-last '--remove-last) -(defun -remove-item (item list) - "Remove all occurrences of ITEM from LIST. - -Comparison is done with `equal'." - (declare (pure t) (side-effect-free t)) - (--remove (equal it item) list)) +(defalias '-remove-item #'remove + "Return a copy of LIST with all occurrences of ITEM removed. +The comparison is done with `equal'. +\n(fn ITEM LIST)") (defmacro --keep (form list) - "Anaphoric form of `-keep'." + "Eval FORM for each item in LIST and return the non-nil results. +Like `--filter', but returns the non-nil results of FORM instead +of the corresponding elements of LIST. Each element of LIST in +turn is bound to `it' and its index within LIST to `it-index' +before evaluating FORM. +This is the anaphoric counterpart to `-keep'." (declare (debug (form form))) (let ((r (make-symbol "result")) (m (make-symbol "mapped"))) `(let (,r) - (--each ,list (let ((,m ,form)) (when ,m (!cons ,m ,r)))) + (--each ,list (let ((,m ,form)) (when ,m (push ,m ,r)))) (nreverse ,r)))) (defun -keep (fn list) - "Return a new list of the non-nil results of applying FN to the items in LIST. + "Return a new list of the non-nil results of applying FN to each item in LIST. +Like `-filter', but returns the non-nil results of FN instead of +the corresponding elements of LIST. -If you want to select the original items satisfying a predicate use `-filter'." +Its anaphoric counterpart is `--keep'." (--keep (funcall fn it) list)) (defun -non-nil (list) - "Return all non-nil elements of LIST." + "Return a copy of LIST with all nil items removed." (declare (pure t) (side-effect-free t)) - (-remove 'null list)) + (--filter it list)) (defmacro --map-indexed (form list) - "Anaphoric form of `-map-indexed'." + "Eval FORM for each item in LIST and return the list of results. +Each element of LIST in turn is bound to `it' and its index +within LIST to `it-index' before evaluating FORM. This is like +`--map', but additionally makes `it-index' available to FORM. + +This is the anaphoric counterpart to `-map-indexed'." (declare (debug (form form))) (let ((r (make-symbol "result"))) `(let (,r) (--each ,list - (!cons ,form ,r)) + (push ,form ,r)) (nreverse ,r)))) (defun -map-indexed (fn list) - "Return a new list consisting of the result of (FN index item) for each item in LIST. + "Apply FN to each index and item in LIST and return the list of results. +This is like `-map', but FN takes two arguments: the index of the +current element within LIST, and the element itself. -In the anaphoric form `--map-indexed', the index is exposed as symbol `it-index'. +This function's anaphoric counterpart is `--map-indexed'. -See also: `-each-indexed'." +For a side-effecting variant, see also `-each-indexed'." (--map-indexed (funcall fn it-index it) list)) (defmacro --map-when (pred rep list) @@ -635,12 +689,15 @@ Thus function FN should return a list." (defmacro --iterate (form init n) "Anaphoric version of `-iterate'." (declare (debug (form form form))) - (let ((res (make-symbol "result"))) - `(let ((it ,init) ,res) - (dotimes (_ ,n) - (push it ,res) - (setq it ,form)) - (nreverse ,res)))) + (let ((res (make-symbol "result")) + (len (make-symbol "n"))) + `(let ((,len ,n)) + (when (> ,len 0) + (let* ((it ,init) + (,res (list it))) + (dotimes (_ (1- ,len)) + (push (setq it ,form) ,res)) + (nreverse ,res)))))) (defun -iterate (fun init n) "Return a list of iterated applications of FUN to INIT. @@ -674,7 +731,9 @@ See also: `-flatten-n'" See also: `-flatten'" (declare (pure t) (side-effect-free t)) - (-last-item (--iterate (--mapcat (-list it) it) list (1+ num)))) + (dotimes (_ num) + (setq list (apply #'append (mapcar #'-list list)))) + list) (defun -concat (&rest lists) "Return a new list with the concatenation of the elements in the supplied LISTS." @@ -757,7 +816,9 @@ This is the anaphoric counterpart to `-first'." "Return the first item in LIST for which PRED returns non-nil. Return nil if no such element is found. To get the first item in the list no questions asked, use `car'. + Alias: `-find'. + This function's anaphoric counterpart is `--first'." (--first (funcall pred it) list)) @@ -778,7 +839,9 @@ This is the anaphoric counterpart to `-some'." (defun -some (pred list) "Return (PRED x) for the first LIST item where (PRED x) is non-nil, else nil. + Alias: `-any'. + This function's anaphoric counterpart is `--some'." (--some (funcall pred it) list)) @@ -995,7 +1058,9 @@ This is the anaphoric counterpart to `-take-while'." PRED is a function of one argument. Return a new list of the successive elements from the start of LIST for which PRED returns non-nil. + This function's anaphoric counterpart is `--take-while'. + For another variant, see also `-drop-while'." (--take-while (funcall pred it) list)) @@ -1017,7 +1082,9 @@ This is the anaphoric counterpart to `-drop-while'." PRED is a function of one argument. Return the tail (not a copy) of LIST starting from its first element for which PRED returns nil. + This function's anaphoric counterpart is `--drop-while'. + For another variant, see also `-take-while'." (--drop-while (funcall pred it) list)) @@ -1043,6 +1110,7 @@ See also: `-take'." "Return the tail (not a copy) of LIST without the first N items. Return nil if LIST contains N items or fewer. Return LIST if N is zero or less. + For another variant, see also `-drop-last'. \n(fn N LIST)") @@ -1574,13 +1642,6 @@ See also: `-flatten-n', `-table'" (dash--table-carry lists restore-lists))) (nreverse re))) -(defun -partial (fn &rest args) - "Take a function FN and fewer than the normal arguments to FN, -and return a fn that takes a variable number of additional ARGS. -When called, the returned function calls FN with ARGS first and -then additional args." - (apply 'apply-partially fn args)) - (defun -elem-index (elem list) "Return the index of the first element in the given LIST which is equal to the query element ELEM, or nil if there is no @@ -1668,7 +1729,8 @@ See also: `-select-columns', `-select-by-indices'" in the first form, making a list of it if it is not a list already. If there are more forms, insert the first form as the second item in second form, etc." - (declare (debug (form &rest [&or symbolp (sexp &rest form)]))) + (declare (debug (form &rest [&or symbolp (sexp &rest form)])) + (indent 1)) (cond ((null form) x) ((null more) (if (listp form) @@ -1681,7 +1743,8 @@ second item in second form, etc." in the first form, making a list of it if it is not a list already. If there are more forms, insert the first form as the last item in second form, etc." - (declare (debug ->)) + (declare (debug ->) + (indent 1)) (cond ((null form) x) ((null more) (if (listp form) @@ -1735,23 +1798,24 @@ and when that result is non-nil, through the next form, etc." (->> ,result ,form)) ,@more)))) -(defmacro -some--> (x &optional form &rest more) - "When expr is non-nil, thread it through the first form (via `-->'), -and when that result is non-nil, through the next form, etc." - (declare (debug ->) - (indent 1)) - (if (null form) x +(defmacro -some--> (expr &rest forms) + "Thread EXPR through FORMS via `-->', while the result is non-nil. +When EXPR evaluates to non-nil, thread the result through the +first of FORMS, and when that result is non-nil, thread it +through the next form, etc." + (declare (debug (form &rest &or symbolp consp)) (indent 1)) + (if (null forms) expr (let ((result (make-symbol "result"))) - `(-some--> (-when-let (,result ,x) - (--> ,result ,form)) - ,@more)))) + `(-some--> (-when-let (,result ,expr) + (--> ,result ,(car forms))) + ,@(cdr forms))))) (defmacro -doto (init &rest forms) "Evaluate INIT and pass it as argument to FORMS with `->'. The RESULT of evaluating INIT is threaded through each of FORMS individually using `->', which see. The return value is RESULT, which FORMS may have modified by side effect." - (declare (debug (form body)) (indent 1)) + (declare (debug (form &rest &or symbolp consp)) (indent 1)) (let ((retval (make-symbol "result"))) `(let ((,retval ,init)) ,@(mapcar (lambda (form) `(-> ,retval ,form)) forms) @@ -2588,20 +2652,22 @@ Alias: `-same-items-p'" (defalias '-same-items-p '-same-items?) (defun -is-prefix? (prefix list) - "Return non-nil if PREFIX is prefix of LIST. + "Return non-nil if PREFIX is a prefix of LIST. -Alias: `-is-prefix-p'" +Alias: `-is-prefix-p'." (declare (pure t) (side-effect-free t)) - (--each-while list (equal (car prefix) it) - (!cdr prefix)) - (not prefix)) + (--each-while list (and (equal (car prefix) it) + (!cdr prefix))) + (null prefix)) (defun -is-suffix? (suffix list) - "Return non-nil if SUFFIX is suffix of LIST. + "Return non-nil if SUFFIX is a suffix of LIST. -Alias: `-is-suffix-p'" +Alias: `-is-suffix-p'." (declare (pure t) (side-effect-free t)) - (-is-prefix? (reverse suffix) (reverse list))) + (cond ((null suffix)) + ((setq list (member (car suffix) list)) + (equal (cdr suffix) (cdr list))))) (defun -is-infix? (infix list) "Return non-nil if INFIX is infix of LIST. @@ -2768,6 +2834,7 @@ the new seed." (defun -cons-pair? (obj) "Return non-nil if OBJ is a true cons pair. That is, a cons (A . B) where B is not a list. + Alias: `-cons-pair-p'." (declare (pure t) (side-effect-free t)) (nlistp (cdr-safe obj))) @@ -2934,20 +3001,214 @@ structure such as plist or alist." (declare (pure t) (side-effect-free t)) (-tree-map 'identity list)) +;;; Combinators + +(defalias '-partial #'apply-partially) + +(defun -rpartial (fn &rest args) + "Return a function that is a partial application of FN to ARGS. +ARGS is a list of the last N arguments to pass to FN. The result +is a new function which does the same as FN, except that the last +N arguments are fixed at the values with which this function was +called. This is like `-partial', except the arguments are fixed +starting from the right rather than the left." + (declare (pure t) (side-effect-free t)) + (lambda (&rest args-before) (apply fn (append args-before args)))) + +(defun -juxt (&rest fns) + "Return a function that is the juxtaposition of FNS. +The returned function takes a variable number of ARGS, applies +each of FNS in turn to ARGS, and returns the list of results." + (declare (pure t) (side-effect-free t)) + (lambda (&rest args) (mapcar (lambda (x) (apply x args)) fns))) + +(defun -compose (&rest fns) + "Compose FNS into a single composite function. +Return a function that takes a variable number of ARGS, applies +the last function in FNS to ARGS, and returns the result of +calling each remaining function on the result of the previous +function, right-to-left. If no FNS are given, return a variadic +`identity' function." + (declare (pure t) (side-effect-free t)) + (let* ((fns (nreverse fns)) + (head (car fns)) + (tail (cdr fns))) + (cond (tail + (lambda (&rest args) + (--reduce-from (funcall it acc) (apply head args) tail))) + (fns head) + ((lambda (&optional arg &rest _) arg))))) + +(defun -applify (fn) + "Return a function that applies FN to a single list of args. +This changes the arity of FN from taking N distinct arguments to +taking 1 argument which is a list of N arguments." + (declare (pure t) (side-effect-free t)) + (lambda (args) (apply fn args))) + +(defun -on (operator transformer) + "Return a function of two arguments that first applies +TRANSFORMER to each of them and then applies OPERATOR on the +results (in the same order). + +In types: (b -> b -> c) -> (a -> b) -> a -> a -> c" + (lambda (x y) (funcall operator (funcall transformer x) (funcall transformer y)))) + +(defun -flip (func) + "Swap the order of arguments for binary function FUNC. + +In types: (a -> b -> c) -> b -> a -> c" + (lambda (x y) (funcall func y x))) + +(defun -const (c) + "Return a function that returns C ignoring any additional arguments. + +In types: a -> b -> a" + (lambda (&rest _) c)) + +(defmacro -cut (&rest params) + "Take n-ary function and n arguments and specialize some of them. +Arguments denoted by <> will be left unspecialized. + +See SRFI-26 for detailed description." + (let* ((i 0) + (args (--keep (when (eq it '<>) + (setq i (1+ i)) + (make-symbol (format "D%d" i))) + params))) + `(lambda ,args + ,(let ((body (--map (if (eq it '<>) (pop args) it) params))) + (if (eq (car params) '<>) + (cons 'funcall body) + body))))) + +(defun -not (pred) + "Take a unary predicate PRED and return a unary predicate +that returns t if PRED returns nil and nil if PRED returns +non-nil." + (lambda (x) (not (funcall pred x)))) + +(defun -orfn (&rest preds) + "Take list of unary predicates PREDS and return a unary +predicate with argument x that returns non-nil if at least one of +the PREDS returns non-nil on x. + +In types: [a -> Bool] -> a -> Bool" + (lambda (x) (-any? (-cut funcall <> x) preds))) + +(defun -andfn (&rest preds) + "Take list of unary predicates PREDS and return a unary +predicate with argument x that returns non-nil if all of the +PREDS returns non-nil on x. + +In types: [a -> Bool] -> a -> Bool" + (lambda (x) (-all? (-cut funcall <> x) preds))) + +(defun -iteratefn (fn n) + "Return a function FN composed N times with itself. + +FN is a unary function. If you need to use a function of higher +arity, use `-applify' first to turn it into a unary function. + +With n = 0, this acts as identity function. + +In types: (a -> a) -> Int -> a -> a. + +This function satisfies the following law: + + (funcall (-iteratefn fn n) init) = (-last-item (-iterate fn init (1+ n)))." + (lambda (x) (--dotimes n (setq x (funcall fn x))) x)) + +(defun -counter (&optional beg end inc) + "Return a closure that counts from BEG to END, with increment INC. + +The closure will return the next value in the counting sequence +each time it is called, and nil after END is reached. BEG +defaults to 0, INC defaults to 1, and if END is nil, the counter +will increment indefinitely. + +The closure accepts any number of arguments, which are discarded." + (let ((inc (or inc 1)) + (n (or beg 0))) + (lambda (&rest _) + (when (or (not end) (< n end)) + (prog1 n + (setq n (+ n inc))))))) + +(defvar -fixfn-max-iterations 1000 + "The default maximum number of iterations performed by `-fixfn' + unless otherwise specified.") + +(defun -fixfn (fn &optional equal-test halt-test) + "Return a function that computes the (least) fixpoint of FN. + +FN must be a unary function. The returned lambda takes a single +argument, X, the initial value for the fixpoint iteration. The +iteration halts when either of the following conditions is satisfied: + + 1. Iteration converges to the fixpoint, with equality being + tested using EQUAL-TEST. If EQUAL-TEST is not specified, + `equal' is used. For functions over the floating point + numbers, it may be necessary to provide an appropriate + approximate comparison test. + + 2. HALT-TEST returns a non-nil value. HALT-TEST defaults to a + simple counter that returns t after `-fixfn-max-iterations', + to guard against infinite iteration. Otherwise, HALT-TEST + must be a function that accepts a single argument, the + current value of X, and returns non-nil as long as iteration + should continue. In this way, a more sophisticated + convergence test may be supplied by the caller. + +The return value of the lambda is either the fixpoint or, if +iteration halted before converging, a cons with car `halted' and +cdr the final output from HALT-TEST. + +In types: (a -> a) -> a -> a." + (let ((eqfn (or equal-test 'equal)) + (haltfn (or halt-test + (-not + (-counter 0 -fixfn-max-iterations))))) + (lambda (x) + (let ((re (funcall fn x)) + (halt? (funcall haltfn x))) + (while (and (not halt?) (not (funcall eqfn x re))) + (setq x re + re (funcall fn re) + halt? (funcall haltfn re))) + (if halt? (cons 'halted halt?) + re))))) + +(defun -prodfn (&rest fns) + "Take a list of n functions and return a function that takes a +list of length n, applying i-th function to i-th element of the +input list. Returns a list of length n. + +In types (for n=2): ((a -> b), (c -> d)) -> (a, c) -> (b, d) + +This function satisfies the following laws: + + (-compose (-prodfn f g ...) (-prodfn f\\=' g\\=' ...)) = (-prodfn (-compose f f\\=') (-compose g g\\=') ...) + (-prodfn f g ...) = (-juxt (-compose f (-partial \\='nth 0)) (-compose g (-partial \\='nth 1)) ...) + (-compose (-prodfn f g ...) (-juxt f\\=' g\\=' ...)) = (-juxt (-compose f f\\=') (-compose g g\\=') ...) + (-compose (-partial \\='nth n) (-prod f1 f2 ...)) = (-compose fn (-partial \\='nth n))" + (lambda (x) (-zip-with 'funcall fns x))) + ;;; Font lock (defvar dash--keywords `(;; TODO: Do not fontify the following automatic variables ;; globally; detect and limit to their local anaphoric scope. - (,(concat "\\_<" (regexp-opt '("acc" "it" "it-index" "other")) "\\_>") + (,(rx symbol-start (| "acc" "it" "it-index" "other") symbol-end) 0 font-lock-variable-name-face) ;; Macros in dev/examples.el. Based on `lisp-mode-symbol-regexp'. - (,(concat "(" (regexp-opt '("defexamples" "def-example-group") t) - "\\_>[\t ]+\\(\\(?:\\sw\\|\\s_\\|\\\\.\\)*\\)") + (,(rx ?\( (group (| "defexamples" "def-example-group")) symbol-end + (+ (in "\t ")) + (group (* (| (syntax word) (syntax symbol) (: ?\\ nonl))))) (1 font-lock-keyword-face) (2 font-lock-function-name-face)) ;; Symbols in dev/examples.el. - ,(concat "\\_<" (regexp-opt '("=>" "~>" "!!>")) "\\_>") + ,(rx symbol-start (| "=>" "~>" "!!>") symbol-end) ;; Elisp macro fontification was static prior to Emacs 25. ,@(when (< emacs-major-version 25) (let ((macs '("!cdr" diff --git a/elpa/dash-20210116.1426/dash.info b/elpa/dash-20210330.1544/dash.info similarity index 82% rename from elpa/dash-20210116.1426/dash.info rename to elpa/dash-20210330.1544/dash.info index a5360bf..08648b0 100644 --- a/elpa/dash-20210116.1426/dash.info +++ b/elpa/dash-20210330.1544/dash.info @@ -1,6 +1,6 @@ -This is dash.info, produced by makeinfo version 6.5 from dash.texi. +This is dash.info, produced by makeinfo version 6.7 from dash.texi. -This manual is for Dash version 2.17.0. +This manual is for Dash version 2.18.1. Copyright © 2012–2021 Free Software Foundation, Inc. @@ -22,7 +22,7 @@ File: dash.info, Node: Top, Next: Installation, Up: (dir) Dash **** -This manual is for Dash version 2.17.0. +This manual is for Dash version 2.18.1. Copyright © 2012–2021 Free Software Foundation, Inc. @@ -76,7 +76,6 @@ Functions Development * Contribute:: How to contribute. -* Change log:: List of significant changes by version. * Contributors:: List of contributors.  @@ -85,18 +84,16 @@ File: dash.info, Node: Installation, Next: Functions, Prev: Top, Up: Top 1 Installation ************** -Dash is available on GNU ELPA (https://elpa.gnu.org/) and MELPA -(https://melpa.org/), and can be installed with the standard command -‘package-install’ (*note (emacs)Package Installation::). +Dash is available on GNU ELPA (https://elpa.gnu.org/), GNU-devel ELPA +(https://elpa.gnu.org/devel/), and MELPA (https://melpa.org/), and can +be installed with the standard command ‘package-install’ (*note +(emacs)Package Installation::). ‘M-x package-install dash ’ Install the Dash library. -‘M-x package-install dash-functional ’ - Install an optional library of additional function combinators. - - Alternatively, you can just dump ‘dash.el’ or ‘dash-functional.el’ in -your load path somewhere. + Alternatively, you can just dump ‘dash.el’ in your ‘load-path’ +somewhere (*note (emacs)Lisp Libraries::). * Menu: @@ -113,12 +110,7 @@ File: dash.info, Node: Using in a package, Next: Fontification of special vari If you use Dash in your own package, be sure to list it as a dependency in the library’s headers as follows (*note (elisp)Library Headers::). - ;; Package-Requires: ((dash "2.17.0")) - - The same goes for the ‘dash-functional.el’ library of function -combinators: - - ;; Package-Requires: ((dash "2.17.0") (dash-functional "1.2.0")) + ;; Package-Requires: ((dash "2.18.1"))  File: dash.info, Node: Fontification of special variables, Next: Info symbol lookup, Prev: Using in a package, Up: Installation @@ -220,15 +212,16 @@ applied sequentially to each or selected elements of the input list. The results are collected in order and returned as a new list. -- Function: -map (fn list) - Apply FN to each item in LIST and return the list of results. This - function’s anaphoric counterpart is ‘--map’. + Apply FN to each item in LIST and return the list of results. + + This function’s anaphoric counterpart is ‘--map’. (-map (lambda (num) (* num num)) '(1 2 3 4)) - ⇒ '(1 4 9 16) + ⇒ (1 4 9 16) (-map #'1+ '(1 2 3 4)) - ⇒ '(2 3 4 5) + ⇒ (2 3 4 5) (--map (* it it) '(1 2 3 4)) - ⇒ '(1 4 9 16) + ⇒ (1 4 9 16) -- Function: -map-when (pred rep list) Return a new list where the elements in LIST that do not match the @@ -240,11 +233,11 @@ The results are collected in order and returned as a new list. See also: ‘-update-at’ (*note -update-at::) (-map-when 'even? 'square '(1 2 3 4)) - ⇒ '(1 4 3 16) + ⇒ (1 4 3 16) (--map-when (> it 2) (* it it) '(1 2 3 4)) - ⇒ '(1 2 9 16) + ⇒ (1 2 9 16) (--map-when (= it 2) 17 '(1 2 3 4)) - ⇒ '(1 17 3 4) + ⇒ (1 17 3 4) -- Function: -map-first (pred rep list) Replace first item in LIST satisfying PRED with result of REP @@ -254,11 +247,11 @@ The results are collected in order and returned as a new list. -replace-first::) (-map-first 'even? 'square '(1 2 3 4)) - ⇒ '(1 4 3 4) + ⇒ (1 4 3 4) (--map-first (> it 2) (* it it) '(1 2 3 4)) - ⇒ '(1 2 9 4) + ⇒ (1 2 9 4) (--map-first (= it 2) 17 '(1 2 3 2)) - ⇒ '(1 17 3 2) + ⇒ (1 17 3 2) -- Function: -map-last (pred rep list) Replace last item in LIST satisfying PRED with result of REP called @@ -268,36 +261,40 @@ The results are collected in order and returned as a new list. -replace-last::) (-map-last 'even? 'square '(1 2 3 4)) - ⇒ '(1 2 3 16) + ⇒ (1 2 3 16) (--map-last (> it 2) (* it it) '(1 2 3 4)) - ⇒ '(1 2 3 16) + ⇒ (1 2 3 16) (--map-last (= it 2) 17 '(1 2 3 2)) - ⇒ '(1 2 3 17) + ⇒ (1 2 3 17) -- Function: -map-indexed (fn list) - Return a new list consisting of the result of (FN index item) for - each item in LIST. + Apply FN to each index and item in LIST and return the list of + results. This is like ‘-map’ (*note -map::), but FN takes two + arguments: the index of the current element within LIST, and the + element itself. - In the anaphoric form ‘--map-indexed’, the index is exposed as - symbol ‘it-index’. + This function’s anaphoric counterpart is ‘--map-indexed’. - See also: ‘-each-indexed’ (*note -each-indexed::). + For a side-effecting variant, see also ‘-each-indexed’ (*note + -each-indexed::). (-map-indexed (lambda (index item) (- item index)) '(1 2 3 4)) - ⇒ '(1 1 1 1) + ⇒ (1 1 1 1) (--map-indexed (- it it-index) '(1 2 3 4)) - ⇒ '(1 1 1 1) + ⇒ (1 1 1 1) + (-map-indexed #'* '(1 2 3 4)) + ⇒ (0 2 6 12) -- Function: -annotate (fn list) Return a list of cons cells where each cell is FN applied to each element of LIST paired with the unmodified element of LIST. (-annotate '1+ '(1 2 3)) - ⇒ '((2 . 1) (3 . 2) (4 . 3)) + ⇒ ((2 . 1) (3 . 2) (4 . 3)) (-annotate 'length '(("h" "e" "l" "l" "o") ("hello" "world"))) - ⇒ '((5 "h" "e" "l" "l" "o") (2 "hello" "world")) + ⇒ ((5 "h" "e" "l" "l" "o") (2 "hello" "world")) (--annotate (< 1 it) '(0 1 2 3)) - ⇒ '((nil . 0) (nil . 1) (t . 2) (t . 3)) + ⇒ ((nil . 0) (nil . 1) (t . 2) (t . 3)) -- Function: -splice (pred fun list) Splice lists generated by FUN in place of elements matching PRED in @@ -313,11 +310,11 @@ The results are collected in order and returned as a new list. (*note -insert-at::) (-splice 'even? (lambda (x) (list x x)) '(1 2 3 4)) - ⇒ '(1 2 2 3 4 4) + ⇒ (1 2 2 3 4 4) (--splice 't (list it it) '(1 2 3 4)) - ⇒ '(1 1 2 2 3 3 4 4) + ⇒ (1 1 2 2 3 3 4 4) (--splice (equal it :magic) '((list of) (magical) (code)) '((foo) (bar) :magic (baz))) - ⇒ '((foo) (bar) (list of) (magical) (code) (baz)) + ⇒ ((foo) (bar) (list of) (magical) (code) (baz)) -- Function: -splice-list (pred new-list list) Splice NEW-LIST in place of elements matching PRED in LIST. @@ -326,30 +323,28 @@ The results are collected in order and returned as a new list. -insert-at::) (-splice-list 'keywordp '(a b c) '(1 :foo 2)) - ⇒ '(1 a b c 2) + ⇒ (1 a b c 2) (-splice-list 'keywordp nil '(1 :foo 2)) - ⇒ '(1 2) + ⇒ (1 2) (--splice-list (keywordp it) '(a b c) '(1 :foo 2)) - ⇒ '(1 a b c 2) + ⇒ (1 a b c 2) -- Function: -mapcat (fn list) Return the concatenation of the result of mapping FN over LIST. Thus function FN should return a list. (-mapcat 'list '(1 2 3)) - ⇒ '(1 2 3) + ⇒ (1 2 3) (-mapcat (lambda (item) (list 0 item)) '(1 2 3)) - ⇒ '(0 1 0 2 0 3) + ⇒ (0 1 0 2 0 3) (--mapcat (list 0 it) '(1 2 3)) - ⇒ '(0 1 0 2 0 3) + ⇒ (0 1 0 2 0 3) - -- Function: -copy (arg) + -- Function: -copy (list) Create a shallow copy of LIST. - (fn LIST) - (-copy '(1 2 3)) - ⇒ '(1 2 3) + ⇒ (1 2 3) (let ((a '(1 2 3))) (eq a (-copy a))) ⇒ nil @@ -363,79 +358,99 @@ Functions returning a sublist of the original list. -- Function: -filter (pred list) Return a new list of the items in LIST for which PRED returns - non-nil. Alias: ‘-select’. This function’s anaphoric counterpart - ‘--filter’. For similar operations, see also ‘-keep’ (*note - -keep::) and ‘-remove’ (*note -remove::). + non-nil. + + Alias: ‘-select’. + + This function’s anaphoric counterpart is ‘--filter’. + + For similar operations, see also ‘-keep’ (*note -keep::) and + ‘-remove’ (*note -remove::). (-filter (lambda (num) (= 0 (% num 2))) '(1 2 3 4)) - ⇒ '(2 4) + ⇒ (2 4) (-filter #'natnump '(-2 -1 0 1 2)) - ⇒ '(0 1 2) + ⇒ (0 1 2) (--filter (= 0 (% it 2)) '(1 2 3 4)) - ⇒ '(2 4) + ⇒ (2 4) -- Function: -remove (pred list) Return a new list of the items in LIST for which PRED returns nil. - Alias: ‘-reject’. This function’s anaphoric counterpart - ‘--remove’. For similar operations, see also ‘-keep’ (*note - -keep::) and ‘-filter’ (*note -filter::). + + Alias: ‘-reject’. + + This function’s anaphoric counterpart is ‘--remove’. + + For similar operations, see also ‘-keep’ (*note -keep::) and + ‘-filter’ (*note -filter::). (-remove (lambda (num) (= 0 (% num 2))) '(1 2 3 4)) - ⇒ '(1 3) + ⇒ (1 3) (-remove #'natnump '(-2 -1 0 1 2)) - ⇒ '(-2 -1) + ⇒ (-2 -1) (--remove (= 0 (% it 2)) '(1 2 3 4)) - ⇒ '(1 3) + ⇒ (1 3) -- Function: -remove-first (pred list) Remove the first item from LIST for which PRED returns non-nil. This is a non-destructive operation, but only the front of LIST leading up to the removed item is a copy; the rest is LIST’s original tail. If no item is removed, then the result is a - complete copy. Alias: ‘-reject-first’. This function’s anaphoric - counterpart is ‘--remove-first’. See also ‘-map-first’ (*note - -map-first::), ‘-remove-item’ (*note -remove-item::), and - ‘-remove-last’ (*note -remove-last::). + complete copy. + + Alias: ‘-reject-first’. + + This function’s anaphoric counterpart is ‘--remove-first’. + + See also ‘-map-first’ (*note -map-first::), ‘-remove-item’ (*note + -remove-item::), and ‘-remove-last’ (*note -remove-last::). (-remove-first #'natnump '(-2 -1 0 1 2)) - ⇒ '(-2 -1 1 2) + ⇒ (-2 -1 1 2) (-remove-first #'stringp '(1 2 "first" "second")) - ⇒ '(1 2 "second") + ⇒ (1 2 "second") (--remove-first (> it 3) '(1 2 3 4 5 6)) - ⇒ '(1 2 3 5 6) + ⇒ (1 2 3 5 6) -- Function: -remove-last (pred list) - Return a new list with the last item matching PRED removed. + Remove the last item from LIST for which PRED returns non-nil. The + result is a copy of LIST regardless of whether an element is + removed. - Alias: ‘-reject-last’ + Alias: ‘-reject-last’. - See also: ‘-remove’ (*note -remove::), ‘-map-last’ (*note - -map-last::) + This function’s anaphoric counterpart is ‘--remove-last’. - (-remove-last 'even? '(1 3 5 4 7 8 10 11)) - ⇒ '(1 3 5 4 7 8 11) - (-remove-last 'stringp '(1 2 "last" "second" "third")) - ⇒ '(1 2 "last" "second") + See also ‘-map-last’ (*note -map-last::), ‘-remove-item’ (*note + -remove-item::), and ‘-remove-first’ (*note -remove-first::). + + (-remove-last #'natnump '(1 3 5 4 7 8 10 -11)) + ⇒ (1 3 5 4 7 8 -11) + (-remove-last #'stringp '(1 2 "last" "second")) + ⇒ (1 2 "last") (--remove-last (> it 3) '(1 2 3 4 5 6 7 8 9 10)) - ⇒ '(1 2 3 4 5 6 7 8 9) + ⇒ (1 2 3 4 5 6 7 8 9) -- Function: -remove-item (item list) - Remove all occurrences of ITEM from LIST. - - Comparison is done with ‘equal’. + Return a copy of LIST with all occurrences of ITEM removed. The + comparison is done with ‘equal’. (-remove-item 3 '(1 2 3 2 3 4 5 3)) - ⇒ '(1 2 2 4 5) + ⇒ (1 2 2 4 5) (-remove-item 'foo '(foo bar baz foo)) - ⇒ '(bar baz) - (-remove-item "bob" '("alice" "bob" "eve" "bob" "dave")) - ⇒ '("alice" "eve" "dave") + ⇒ (bar baz) + (-remove-item "bob" '("alice" "bob" "eve" "bob")) + ⇒ ("alice" "eve") -- Function: -non-nil (list) - Return all non-nil elements of LIST. + Return a copy of LIST with all nil items removed. - (-non-nil '(1 nil 2 nil nil 3 4 nil 5 nil)) - ⇒ '(1 2 3 4 5) + (-non-nil '(nil 1 nil 2 nil nil 3 4 nil 5 nil)) + ⇒ (1 2 3 4 5) + (-non-nil '((nil))) + ⇒ ((nil)) + (-non-nil ()) + ⇒ () -- Function: -slice (list from &optional to step) Return copy of LIST, starting from index FROM to index TO. @@ -447,11 +462,11 @@ Functions returning a sublist of the original list. is returned. Defaults to 1. (-slice '(1 2 3 4 5) 1) - ⇒ '(2 3 4 5) + ⇒ (2 3 4 5) (-slice '(1 2 3 4 5) 0 3) - ⇒ '(1 2 3) + ⇒ (1 2 3) (-slice '(1 2 3 4 5 6 7 8 9) 1 -1 2) - ⇒ '(2 4 6 8) + ⇒ (2 4 6 8) -- Function: -take (n list) Return a copy of the first N items in LIST. Return a copy of LIST @@ -460,11 +475,11 @@ Functions returning a sublist of the original list. See also: ‘-take-last’ (*note -take-last::). (-take 3 '(1 2 3 4 5)) - ⇒ '(1 2 3) + ⇒ (1 2 3) (-take 17 '(1 2 3 4 5)) - ⇒ '(1 2 3 4 5) + ⇒ (1 2 3 4 5) (-take 0 '(1 2 3 4 5)) - ⇒ nil + ⇒ () -- Function: -take-last (n list) Return a copy of the last N items of LIST in order. Return a copy @@ -474,26 +489,25 @@ Functions returning a sublist of the original list. See also: ‘-take’ (*note -take::). (-take-last 3 '(1 2 3 4 5)) - ⇒ '(3 4 5) + ⇒ (3 4 5) (-take-last 17 '(1 2 3 4 5)) - ⇒ '(1 2 3 4 5) + ⇒ (1 2 3 4 5) (-take-last 1 '(1 2 3 4 5)) - ⇒ '(5) + ⇒ (5) -- Function: -drop (n list) Return the tail (not a copy) of LIST without the first N items. Return nil if LIST contains N items or fewer. Return LIST if N is - zero or less. For another variant, see also ‘-drop-last’ (*note - -drop-last::). + zero or less. - (fn N LIST) + For another variant, see also ‘-drop-last’ (*note -drop-last::). (-drop 3 '(1 2 3 4 5)) - ⇒ '(4 5) + ⇒ (4 5) (-drop 17 '(1 2 3 4 5)) - ⇒ nil + ⇒ () (-drop 0 '(1 2 3 4 5)) - ⇒ '(1 2 3 4 5) + ⇒ (1 2 3 4 5) -- Function: -drop-last (n list) Return a copy of LIST without its last N items. Return a copy of @@ -503,50 +517,55 @@ Functions returning a sublist of the original list. See also: ‘-drop’ (*note -drop::). (-drop-last 3 '(1 2 3 4 5)) - ⇒ '(1 2) + ⇒ (1 2) (-drop-last 17 '(1 2 3 4 5)) - ⇒ nil + ⇒ () (-drop-last 0 '(1 2 3 4 5)) - ⇒ '(1 2 3 4 5) + ⇒ (1 2 3 4 5) -- Function: -take-while (pred list) Take successive items from LIST for which PRED returns non-nil. PRED is a function of one argument. Return a new list of the successive elements from the start of LIST for which PRED returns - non-nil. This function’s anaphoric counterpart is ‘--take-while’. + non-nil. + + This function’s anaphoric counterpart is ‘--take-while’. + For another variant, see also ‘-drop-while’ (*note -drop-while::). (-take-while #'even? '(1 2 3 4)) - ⇒ nil + ⇒ () (-take-while #'even? '(2 4 5 6)) - ⇒ '(2 4) + ⇒ (2 4) (--take-while (< it 4) '(1 2 3 4 3 2 1)) - ⇒ '(1 2 3) + ⇒ (1 2 3) -- Function: -drop-while (pred list) Drop successive items from LIST for which PRED returns non-nil. PRED is a function of one argument. Return the tail (not a copy) of LIST starting from its first element for which PRED returns nil. - This function’s anaphoric counterpart is ‘--drop-while’. For - another variant, see also ‘-take-while’ (*note -take-while::). + + This function’s anaphoric counterpart is ‘--drop-while’. + + For another variant, see also ‘-take-while’ (*note -take-while::). (-drop-while #'even? '(1 2 3 4)) - ⇒ '(1 2 3 4) + ⇒ (1 2 3 4) (-drop-while #'even? '(2 4 5 6)) - ⇒ '(5 6) + ⇒ (5 6) (--drop-while (< it 4) '(1 2 3 4 3 2 1)) - ⇒ '(4 3 2 1) + ⇒ (4 3 2 1) -- Function: -select-by-indices (indices list) Return a list whose elements are elements from LIST selected as ‘(nth i list)‘ for all i from INDICES. (-select-by-indices '(4 10 2 3 6) '("v" "e" "l" "o" "c" "i" "r" "a" "p" "t" "o" "r")) - ⇒ '("c" "o" "l" "o" "r") + ⇒ ("c" "o" "l" "o" "r") (-select-by-indices '(2 1 0) '("a" "b" "c")) - ⇒ '("c" "b" "a") + ⇒ ("c" "b" "a") (-select-by-indices '(0 1 2 0 1 3 3 1) '("f" "a" "r" "l")) - ⇒ '("f" "a" "r" "f" "a" "l" "l" "a") + ⇒ ("f" "a" "r" "f" "a" "l" "l" "a") -- Function: -select-columns (columns table) Select COLUMNS from TABLE. @@ -561,11 +580,11 @@ Functions returning a sublist of the original list. ‘-select-by-indices’ (*note -select-by-indices::) (-select-columns '(0 2) '((1 2 3) (a b c) (:a :b :c))) - ⇒ '((1 3) (a c) (:a :c)) + ⇒ ((1 3) (a c) (:a :c)) (-select-columns '(1) '((1 2 3) (a b c) (:a :b :c))) - ⇒ '((2) (b) (:b)) + ⇒ ((2) (b) (:b)) (-select-columns nil '((1 2 3) (a b c) (:a :b :c))) - ⇒ '(nil nil nil) + ⇒ (nil nil nil) -- Function: -select-column (column table) Select COLUMN from TABLE. @@ -579,7 +598,7 @@ Functions returning a sublist of the original list. ‘-select-by-indices’ (*note -select-by-indices::) (-select-column 1 '((1 2 3) (a b c) (:a :b :c))) - ⇒ '(2 b :b) + ⇒ (2 b :b)  File: dash.info, Node: List to list, Next: Reductions, Prev: Sublist selection, Up: Functions @@ -590,29 +609,30 @@ File: dash.info, Node: List to list, Next: Reductions, Prev: Sublist selectio Functions returning a modified copy of the input list. -- Function: -keep (fn list) - Return a new list of the non-nil results of applying FN to the - items in LIST. + Return a new list of the non-nil results of applying FN to each + item in LIST. Like ‘-filter’ (*note -filter::), but returns the + non-nil results of FN instead of the corresponding elements of + LIST. - If you want to select the original items satisfying a predicate use - ‘-filter’ (*note -filter::). + Its anaphoric counterpart is ‘--keep’. - (-keep 'cdr '((1 2 3) (4 5) (6))) - ⇒ '((2 3) (5)) - (-keep (lambda (num) (when (> num 3) (* 10 num))) '(1 2 3 4 5 6)) - ⇒ '(40 50 60) - (--keep (when (> it 3) (* 10 it)) '(1 2 3 4 5 6)) - ⇒ '(40 50 60) + (-keep #'cdr '((1 2 3) (4 5) (6))) + ⇒ ((2 3) (5)) + (-keep (lambda (n) (and (> n 3) (* 10 n))) '(1 2 3 4 5 6)) + ⇒ (40 50 60) + (--keep (and (> it 3) (* 10 it)) '(1 2 3 4 5 6)) + ⇒ (40 50 60) -- Function: -concat (&rest lists) Return a new list with the concatenation of the elements in the supplied LISTS. (-concat '(1)) - ⇒ '(1) + ⇒ (1) (-concat '(1) '(2)) - ⇒ '(1 2) + ⇒ (1 2) (-concat '(1) '(2 3) '(4)) - ⇒ '(1 2 3 4) + ⇒ (1 2 3 4) -- Function: -flatten (l) Take a nested list L and return its contents as a single, flat @@ -630,11 +650,11 @@ Functions returning a modified copy of the input list. See also: ‘-flatten-n’ (*note -flatten-n::) (-flatten '((1))) - ⇒ '(1) + ⇒ (1) (-flatten '((1 (2 3) (((4 (5))))))) - ⇒ '(1 2 3 4 5) + ⇒ (1 2 3 4 5) (-flatten '(1 2 (3 . 4))) - ⇒ '(1 2 (3 . 4)) + ⇒ (1 2 (3 . 4)) -- Function: -flatten-n (num list) Flatten NUM levels of a nested LIST. @@ -642,11 +662,11 @@ Functions returning a modified copy of the input list. See also: ‘-flatten’ (*note -flatten::) (-flatten-n 1 '((1 2) ((3 4) ((5 6))))) - ⇒ '(1 2 (3 4) ((5 6))) + ⇒ (1 2 (3 4) ((5 6))) (-flatten-n 2 '((1 2) ((3 4) ((5 6))))) - ⇒ '(1 2 3 4 (5 6)) + ⇒ (1 2 3 4 (5 6)) (-flatten-n 3 '((1 2) ((3 4) ((5 6))))) - ⇒ '(1 2 3 4 5 6) + ⇒ (1 2 3 4 5 6) -- Function: -replace (old new list) Replace all OLD items in LIST with NEW. @@ -656,9 +676,9 @@ Functions returning a modified copy of the input list. See also: ‘-replace-at’ (*note -replace-at::) (-replace 1 "1" '(1 2 3 4 3 2 1)) - ⇒ '("1" 2 3 4 3 2 "1") + ⇒ ("1" 2 3 4 3 2 "1") (-replace "foo" "bar" '("a" "nice" "foo" "sentence" "about" "foo")) - ⇒ '("a" "nice" "bar" "sentence" "about" "bar") + ⇒ ("a" "nice" "bar" "sentence" "about" "bar") (-replace 1 2 nil) ⇒ nil @@ -670,9 +690,9 @@ Functions returning a modified copy of the input list. See also: ‘-map-first’ (*note -map-first::) (-replace-first 1 "1" '(1 2 3 4 3 2 1)) - ⇒ '("1" 2 3 4 3 2 1) + ⇒ ("1" 2 3 4 3 2 1) (-replace-first "foo" "bar" '("a" "nice" "foo" "sentence" "about" "foo")) - ⇒ '("a" "nice" "bar" "sentence" "about" "foo") + ⇒ ("a" "nice" "bar" "sentence" "about" "foo") (-replace-first 1 2 nil) ⇒ nil @@ -684,9 +704,9 @@ Functions returning a modified copy of the input list. See also: ‘-map-last’ (*note -map-last::) (-replace-last 1 "1" '(1 2 3 4 3 2 1)) - ⇒ '(1 2 3 4 3 2 "1") + ⇒ (1 2 3 4 3 2 "1") (-replace-last "foo" "bar" '("a" "nice" "foo" "sentence" "about" "foo")) - ⇒ '("a" "nice" "foo" "sentence" "about" "bar") + ⇒ ("a" "nice" "foo" "sentence" "about" "bar") (-replace-last 1 2 nil) ⇒ nil @@ -697,9 +717,9 @@ Functions returning a modified copy of the input list. -splice-list::) (-insert-at 1 'x '(a b c)) - ⇒ '(a x b c) + ⇒ (a x b c) (-insert-at 12 'x '(a b c)) - ⇒ '(a b c x) + ⇒ (a b c x) -- Function: -replace-at (n x list) Return a list with element at Nth position in LIST replaced with X. @@ -707,11 +727,11 @@ Functions returning a modified copy of the input list. See also: ‘-replace’ (*note -replace::) (-replace-at 0 9 '(0 1 2 3 4 5)) - ⇒ '(9 1 2 3 4 5) + ⇒ (9 1 2 3 4 5) (-replace-at 1 9 '(0 1 2 3 4 5)) - ⇒ '(0 9 2 3 4 5) + ⇒ (0 9 2 3 4 5) (-replace-at 4 9 '(0 1 2 3 4 5)) - ⇒ '(0 1 2 3 9 5) + ⇒ (0 1 2 3 9 5) -- Function: -update-at (n func list) Return a list with element at Nth position in LIST replaced with @@ -720,11 +740,11 @@ Functions returning a modified copy of the input list. See also: ‘-map-when’ (*note -map-when::) (-update-at 0 (lambda (x) (+ x 9)) '(0 1 2 3 4 5)) - ⇒ '(9 1 2 3 4 5) + ⇒ (9 1 2 3 4 5) (-update-at 1 (lambda (x) (+ x 8)) '(0 1 2 3 4 5)) - ⇒ '(0 9 2 3 4 5) + ⇒ (0 9 2 3 4 5) (--update-at 2 (length it) '("foo" "bar" "baz" "quux")) - ⇒ '("foo" "bar" 3 "quux") + ⇒ ("foo" "bar" 3 "quux") -- Function: -remove-at (n list) Return a list with element at Nth position in LIST removed. @@ -733,11 +753,11 @@ Functions returning a modified copy of the input list. ‘-remove’ (*note -remove::) (-remove-at 0 '("0" "1" "2" "3" "4" "5")) - ⇒ '("1" "2" "3" "4" "5") + ⇒ ("1" "2" "3" "4" "5") (-remove-at 1 '("0" "1" "2" "3" "4" "5")) - ⇒ '("0" "2" "3" "4" "5") + ⇒ ("0" "2" "3" "4" "5") (-remove-at 2 '("0" "1" "2" "3" "4" "5")) - ⇒ '("0" "1" "3" "4" "5") + ⇒ ("0" "1" "3" "4" "5") -- Function: -remove-at-indices (indices list) Return a list whose elements are elements from LIST without @@ -747,11 +767,11 @@ Functions returning a modified copy of the input list. -remove::) (-remove-at-indices '(0) '("0" "1" "2" "3" "4" "5")) - ⇒ '("1" "2" "3" "4" "5") + ⇒ ("1" "2" "3" "4" "5") (-remove-at-indices '(0 2 4) '("0" "1" "2" "3" "4" "5")) - ⇒ '("1" "3" "5") + ⇒ ("1" "3" "5") (-remove-at-indices '(0 5) '("0" "1" "2" "3" "4" "5")) - ⇒ '("1" "2" "3" "4") + ⇒ ("1" "2" "3" "4")  File: dash.info, Node: Reductions, Next: Unfolding, Prev: List to list, Up: Functions @@ -767,14 +787,15 @@ Functions reducing lists to a single value (which may also be a list). applying FN to that result and the second element, etc. If LIST is empty, return INIT without calling FN. - This function’s anaphoric counterpart is ‘--reduce-from’. For - other folds, see also ‘-reduce’ (*note -reduce::) and ‘-reduce-r’ - (*note -reduce-r::). + This function’s anaphoric counterpart is ‘--reduce-from’. + + For other folds, see also ‘-reduce’ (*note -reduce::) and + ‘-reduce-r’ (*note -reduce-r::). (-reduce-from #'- 10 '(1 2 3)) ⇒ 4 (-reduce-from #'list 10 '(1 2 3)) - ⇒ '(((10 1) 2) 3) + ⇒ (((10 1) 2) 3) (--reduce-from (concat acc " " it) "START" '("a" "b" "c")) ⇒ "START a b c" @@ -793,14 +814,15 @@ Functions reducing lists to a single value (which may also be a list). applications of FN, and its last link with INIT, and evaluating the resulting expression. - This function’s anaphoric counterpart is ‘--reduce-r-from’. For - other folds, see also ‘-reduce-r’ (*note -reduce-r::) and ‘-reduce’ - (*note -reduce::). + This function’s anaphoric counterpart is ‘--reduce-r-from’. + + For other folds, see also ‘-reduce-r’ (*note -reduce-r::) and + ‘-reduce’ (*note -reduce::). (-reduce-r-from #'- 10 '(1 2 3)) ⇒ -8 (-reduce-r-from #'list 10 '(1 2 3)) - ⇒ '(1 (2 (3 10))) + ⇒ (1 (2 (3 10))) (--reduce-r-from (concat it " " acc) "END" '("a" "b" "c")) ⇒ "a b c END" @@ -811,14 +833,15 @@ Functions reducing lists to a single value (which may also be a list). element, return it without calling FN. If LIST is empty, return the result of calling FN with no arguments. - This function’s anaphoric counterpart is ‘--reduce’. For other - folds, see also ‘-reduce-from’ (*note -reduce-from::) and + This function’s anaphoric counterpart is ‘--reduce’. + + For other folds, see also ‘-reduce-from’ (*note -reduce-from::) and ‘-reduce-r’ (*note -reduce-r::). (-reduce #'- '(1 2 3 4)) ⇒ -8 (-reduce #'list '(1 2 3 4)) - ⇒ '(((1 2) 3) 4) + ⇒ (((1 2) 3) 4) (--reduce (format "%s-%d" acc it) '(1 2 3)) ⇒ "1-2-3" @@ -838,14 +861,15 @@ Functions reducing lists to a single value (which may also be a list). applications of FN, ignoring its last link, and evaluating the resulting expression. - This function’s anaphoric counterpart is ‘--reduce-r’. For other - folds, see also ‘-reduce-r-from’ (*note -reduce-r-from::) and - ‘-reduce’ (*note -reduce::). + This function’s anaphoric counterpart is ‘--reduce-r’. + + For other folds, see also ‘-reduce-r-from’ (*note -reduce-r-from::) + and ‘-reduce’ (*note -reduce::). (-reduce-r #'- '(1 2 3 4)) ⇒ -2 (-reduce-r #'list '(1 2 3 4)) - ⇒ '(1 (2 (3 4))) + ⇒ (1 (2 (3 4))) (--reduce-r (format "%s-%d" acc it) '(1 2 3)) ⇒ "3-2-1" @@ -853,62 +877,73 @@ Functions reducing lists to a single value (which may also be a list). Return a list of FN’s intermediate reductions across LIST. That is, a list of the intermediate values of the accumulator when ‘-reduce-from’ (*note -reduce-from::) (which see) is called with - the same arguments. This function’s anaphoric counterpart is - ‘--reductions-from’. For other folds, see also ‘-reductions’ - (*note -reductions::) and ‘-reductions-r’ (*note -reductions-r::). + the same arguments. + + This function’s anaphoric counterpart is ‘--reductions-from’. + + For other folds, see also ‘-reductions’ (*note -reductions::) and + ‘-reductions-r’ (*note -reductions-r::). (-reductions-from #'max 0 '(2 1 4 3)) - ⇒ '(0 2 2 4 4) + ⇒ (0 2 2 4 4) (-reductions-from #'* 1 '(1 2 3 4)) - ⇒ '(1 1 2 6 24) + ⇒ (1 1 2 6 24) (--reductions-from (format "(FN %s %d)" acc it) "INIT" '(1 2 3)) - ⇒ '("INIT" "(FN INIT 1)" "(FN (FN INIT 1) 2)" "(FN (FN (FN INIT 1) 2) 3)") + ⇒ ("INIT" "(FN INIT 1)" "(FN (FN INIT 1) 2)" "(FN (FN (FN INIT 1) 2) 3)") -- Function: -reductions-r-from (fn init list) Return a list of FN’s intermediate reductions across reversed LIST. That is, a list of the intermediate values of the accumulator when ‘-reduce-r-from’ (*note -reduce-r-from::) (which see) is called - with the same arguments. This function’s anaphoric counterpart is - ‘--reductions-r-from’. For other folds, see also ‘-reductions’ - (*note -reductions::) and ‘-reductions-r’ (*note -reductions-r::). + with the same arguments. + + This function’s anaphoric counterpart is ‘--reductions-r-from’. + + For other folds, see also ‘-reductions’ (*note -reductions::) and + ‘-reductions-r’ (*note -reductions-r::). (-reductions-r-from #'max 0 '(2 1 4 3)) - ⇒ '(4 4 4 3 0) + ⇒ (4 4 4 3 0) (-reductions-r-from #'* 1 '(1 2 3 4)) - ⇒ '(24 24 12 4 1) + ⇒ (24 24 12 4 1) (--reductions-r-from (format "(FN %d %s)" it acc) "INIT" '(1 2 3)) - ⇒ '("(FN 1 (FN 2 (FN 3 INIT)))" "(FN 2 (FN 3 INIT))" "(FN 3 INIT)" "INIT") + ⇒ ("(FN 1 (FN 2 (FN 3 INIT)))" "(FN 2 (FN 3 INIT))" "(FN 3 INIT)" "INIT") -- Function: -reductions (fn list) Return a list of FN’s intermediate reductions across LIST. That is, a list of the intermediate values of the accumulator when ‘-reduce’ (*note -reduce::) (which see) is called with the same - arguments. This function’s anaphoric counterpart is - ‘--reductions’. For other folds, see also ‘-reductions’ (*note - -reductions::) and ‘-reductions-r’ (*note -reductions-r::). + arguments. + + This function’s anaphoric counterpart is ‘--reductions’. + + For other folds, see also ‘-reductions’ (*note -reductions::) and + ‘-reductions-r’ (*note -reductions-r::). (-reductions #'+ '(1 2 3 4)) - ⇒ '(1 3 6 10) + ⇒ (1 3 6 10) (-reductions #'* '(1 2 3 4)) - ⇒ '(1 2 6 24) + ⇒ (1 2 6 24) (--reductions (format "(FN %s %d)" acc it) '(1 2 3)) - ⇒ '(1 "(FN 1 2)" "(FN (FN 1 2) 3)") + ⇒ (1 "(FN 1 2)" "(FN (FN 1 2) 3)") -- Function: -reductions-r (fn list) Return a list of FN’s intermediate reductions across reversed LIST. That is, a list of the intermediate values of the accumulator when ‘-reduce-r’ (*note -reduce-r::) (which see) is called with the same - arguments. This function’s anaphoric counterpart is - ‘--reductions-r’. For other folds, see also ‘-reductions-r-from’ - (*note -reductions-r-from::) and ‘-reductions’ (*note - -reductions::). + arguments. + + This function’s anaphoric counterpart is ‘--reductions-r’. + + For other folds, see also ‘-reductions-r-from’ (*note + -reductions-r-from::) and ‘-reductions’ (*note -reductions::). (-reductions-r #'+ '(1 2 3 4)) - ⇒ '(10 9 7 4) + ⇒ (10 9 7 4) (-reductions-r #'* '(1 2 3 4)) - ⇒ '(24 24 12 4) + ⇒ (24 24 12 4) (--reductions-r (format "(FN %d %s)" it acc) '(1 2 3)) - ⇒ '("(FN 1 (FN 2 3))" "(FN 2 3)" 3) + ⇒ ("(FN 1 (FN 2 3))" "(FN 2 3)" 3) -- Function: -count (pred list) Counts the number of items in LIST where (PRED item) is non-nil. @@ -921,7 +956,7 @@ Functions reducing lists to a single value (which may also be a list). -- Function: -sum (list) Return the sum of LIST. - (-sum '()) + (-sum ()) ⇒ 0 (-sum '(1)) ⇒ 1 @@ -933,16 +968,16 @@ Functions reducing lists to a single value (which may also be a list). non-empty. (-running-sum '(1 2 3 4)) - ⇒ '(1 3 6 10) + ⇒ (1 3 6 10) (-running-sum '(1)) - ⇒ '(1) - (-running-sum nil) - error→ "Wrong type argument: consp, nil" + ⇒ (1) + (-running-sum ()) + error→ Wrong type argument: consp, nil -- Function: -product (list) Return the product of LIST. - (-product '()) + (-product ()) ⇒ 1 (-product '(1)) ⇒ 1 @@ -954,51 +989,51 @@ Functions reducing lists to a single value (which may also be a list). non-empty. (-running-product '(1 2 3 4)) - ⇒ '(1 2 6 24) + ⇒ (1 2 6 24) (-running-product '(1)) - ⇒ '(1) - (-running-product nil) - error→ "Wrong type argument: consp, nil" + ⇒ (1) + (-running-product ()) + error→ Wrong type argument: consp, nil -- Function: -inits (list) Return all prefixes of LIST. (-inits '(1 2 3 4)) - ⇒ '(nil (1) (1 2) (1 2 3) (1 2 3 4)) + ⇒ (nil (1) (1 2) (1 2 3) (1 2 3 4)) (-inits nil) - ⇒ '(nil) + ⇒ (nil) (-inits '(1)) - ⇒ '(nil (1)) + ⇒ (nil (1)) -- Function: -tails (list) Return all suffixes of LIST (-tails '(1 2 3 4)) - ⇒ '((1 2 3 4) (2 3 4) (3 4) (4) nil) + ⇒ ((1 2 3 4) (2 3 4) (3 4) (4) nil) (-tails nil) - ⇒ '(nil) + ⇒ (nil) (-tails '(1)) - ⇒ '((1) nil) + ⇒ ((1) nil) -- Function: -common-prefix (&rest lists) Return the longest common prefix of LISTS. (-common-prefix '(1)) - ⇒ '(1) + ⇒ (1) (-common-prefix '(1 2) '(3 4) '(1 2)) - ⇒ nil + ⇒ () (-common-prefix '(1 2) '(1 2 3) '(1 2 3 4)) - ⇒ '(1 2) + ⇒ (1 2) -- Function: -common-suffix (&rest lists) Return the longest common suffix of LISTS. (-common-suffix '(1)) - ⇒ '(1) + ⇒ (1) (-common-suffix '(1 2) '(3 4) '(1 2)) - ⇒ nil + ⇒ () (-common-suffix '(1 2 3 4) '(2 3 4) '(3 4)) - ⇒ '(3 4) + ⇒ (3 4) -- Function: -min (list) Return the smallest value from LIST of numbers or markers. @@ -1020,9 +1055,9 @@ Functions reducing lists to a single value (which may also be a list). (-min-by '> '(4 3 6 1)) ⇒ 1 (--min-by (> (car it) (car other)) '((1 2 3) (2) (3 2))) - ⇒ '(1 2 3) + ⇒ (1 2 3) (--min-by (> (length it) (length other)) '((1 2 3) (2) (3 2))) - ⇒ '(2) + ⇒ (2) -- Function: -max (list) Return the largest value from LIST of numbers or markers. @@ -1044,9 +1079,9 @@ Functions reducing lists to a single value (which may also be a list). (-max-by '> '(4 3 6 1)) ⇒ 6 (--max-by (> (car it) (car other)) '((1 2 3) (2) (3 2))) - ⇒ '(3 2) + ⇒ (3 2) (--max-by (> (length it) (length other)) '((1 2 3) (2) (3 2))) - ⇒ '(1 2 3) + ⇒ (1 2 3)  File: dash.info, Node: Unfolding, Next: Predicates, Prev: Reductions, Up: Functions @@ -1067,11 +1102,11 @@ than consuming a list to produce a single value. N is the length of the returned list. (-iterate #'1+ 1 10) - ⇒ '(1 2 3 4 5 6 7 8 9 10) + ⇒ (1 2 3 4 5 6 7 8 9 10) (-iterate (lambda (x) (+ x x)) 2 5) - ⇒ '(2 4 8 16 32) + ⇒ (2 4 8 16 32) (--iterate (* it it) 2 5) - ⇒ '(2 4 16 256 65536) + ⇒ (2 4 16 256 65536) -- Function: -unfold (fun seed) Build a list from SEED using FUN. @@ -1086,11 +1121,11 @@ than consuming a list to produce a single value. seed. (-unfold (lambda (x) (unless (= x 0) (cons x (1- x)))) 10) - ⇒ '(10 9 8 7 6 5 4 3 2 1) + ⇒ (10 9 8 7 6 5 4 3 2 1) (--unfold (when it (cons it (cdr it))) '(1 2 3 4)) - ⇒ '((1 2 3 4) (2 3 4) (3 4) (4)) + ⇒ ((1 2 3 4) (2 3 4) (3 4) (4)) (--unfold (when it (cons it (butlast it))) '(1 2 3 4)) - ⇒ '((1 2 3 4) (1 2 3) (1 2) (1)) + ⇒ ((1 2 3 4) (1 2 3) (1 2) (1))  File: dash.info, Node: Predicates, Next: Partitioning, Prev: Unfolding, Up: Functions @@ -1098,6 +1133,8 @@ File: dash.info, Node: Predicates, Next: Partitioning, Prev: Unfolding, Up: 2.6 Predicates ============== +Reductions of one or more lists to a boolean value. + -- Function: -any? (pred list) Return t if (PRED x) is non-nil for any x in LIST, else nil. @@ -1179,9 +1216,9 @@ File: dash.info, Node: Predicates, Next: Partitioning, Prev: Unfolding, Up: ⇒ nil -- Function: -is-prefix? (prefix list) - Return non-nil if PREFIX is prefix of LIST. + Return non-nil if PREFIX is a prefix of LIST. - Alias: ‘-is-prefix-p’ + Alias: ‘-is-prefix-p’. (-is-prefix? '(1 2 3) '(1 2 3 4 5)) ⇒ t @@ -1191,9 +1228,9 @@ File: dash.info, Node: Predicates, Next: Partitioning, Prev: Unfolding, Up: ⇒ nil -- Function: -is-suffix? (suffix list) - Return non-nil if SUFFIX is suffix of LIST. + Return non-nil if SUFFIX is a suffix of LIST. - Alias: ‘-is-suffix-p’ + Alias: ‘-is-suffix-p’. (-is-suffix? '(3 4 5) '(1 2 3 4 5)) ⇒ t @@ -1218,7 +1255,9 @@ File: dash.info, Node: Predicates, Next: Partitioning, Prev: Unfolding, Up: -- Function: -cons-pair? (obj) Return non-nil if OBJ is a true cons pair. That is, a cons (A . - B) where B is not a list. Alias: ‘-cons-pair-p’. + B) where B is not a list. + + Alias: ‘-cons-pair-p’. (-cons-pair? '(1 . 2)) ⇒ t @@ -1244,22 +1283,22 @@ Functions partitioning the input list into a list of lists. split is done in a single list traversal. (-split-at 3 '(1 2 3 4 5)) - ⇒ '((1 2 3) (4 5)) + ⇒ ((1 2 3) (4 5)) (-split-at 17 '(1 2 3 4 5)) - ⇒ '((1 2 3 4 5) nil) + ⇒ ((1 2 3 4 5) nil) (-split-at 0 '(1 2 3 4 5)) - ⇒ '(nil (1 2 3 4 5)) + ⇒ (nil (1 2 3 4 5)) -- Function: -split-with (pred list) Return a list of ((-take-while PRED LIST) (-drop-while PRED LIST)), in no more than one pass through the list. (-split-with 'even? '(1 2 3 4)) - ⇒ '(nil (1 2 3 4)) + ⇒ (nil (1 2 3 4)) (-split-with 'even? '(2 4 5 6)) - ⇒ '((2 4) (5 6)) + ⇒ ((2 4) (5 6)) (--split-with (< it 4) '(1 2 3 4 3 2 1)) - ⇒ '((1 2 3) (4 3 2 1)) + ⇒ ((1 2 3) (4 3 2 1)) -- Macro: -split-on (item list) Split the LIST each time ITEM is found. @@ -1273,11 +1312,11 @@ Functions partitioning the input list into a list of lists. See also ‘-split-when’ (*note -split-when::) (-split-on '| '(Nil | Leaf a | Node [Tree a])) - ⇒ '((Nil) (Leaf a) (Node [Tree a])) + ⇒ ((Nil) (Leaf a) (Node [Tree a])) (-split-on ':endgroup '("a" "b" :endgroup "c" :endgroup "d" "e")) - ⇒ '(("a" "b") ("c") ("d" "e")) + ⇒ (("a" "b") ("c") ("d" "e")) (-split-on ':endgroup '("a" "b" :endgroup :endgroup "d" "e")) - ⇒ '(("a" "b") ("d" "e")) + ⇒ (("a" "b") ("d" "e")) -- Function: -split-when (fn list) Split the LIST on each element where FN returns non-nil. @@ -1290,22 +1329,22 @@ Functions partitioning the input list into a list of lists. ‘split-string’. (-split-when 'even? '(1 2 3 4 5 6)) - ⇒ '((1) (3) (5)) + ⇒ ((1) (3) (5)) (-split-when 'even? '(1 2 3 4 6 8 9)) - ⇒ '((1) (3) (9)) + ⇒ ((1) (3) (9)) (--split-when (memq it '(&optional &rest)) '(a b &optional c d &rest args)) - ⇒ '((a b) (c d) (args)) + ⇒ ((a b) (c d) (args)) -- Function: -separate (pred list) Return a list of ((-filter PRED LIST) (-remove PRED LIST)), in one pass through the list. (-separate (lambda (num) (= 0 (% num 2))) '(1 2 3 4 5 6 7)) - ⇒ '((2 4 6) (1 3 5 7)) + ⇒ ((2 4 6) (1 3 5 7)) (--separate (< it 5) '(3 7 5 9 3 2 1 4 6)) - ⇒ '((3 3 2 1 4) (7 5 9 6)) + ⇒ ((3 3 2 1 4) (7 5 9 6)) (-separate 'cdr '((1 2) (1) (1 2 3) (4))) - ⇒ '(((1 2) (1 2 3)) ((1) (4))) + ⇒ (((1 2) (1 2 3)) ((1) (4))) -- Function: -partition (n list) Return a new list with the items in LIST grouped into N-sized @@ -1313,22 +1352,22 @@ Functions partitioning the input list into a list of lists. N-sized, those items are discarded. (-partition 2 '(1 2 3 4 5 6)) - ⇒ '((1 2) (3 4) (5 6)) + ⇒ ((1 2) (3 4) (5 6)) (-partition 2 '(1 2 3 4 5 6 7)) - ⇒ '((1 2) (3 4) (5 6)) + ⇒ ((1 2) (3 4) (5 6)) (-partition 3 '(1 2 3 4 5 6 7)) - ⇒ '((1 2 3) (4 5 6)) + ⇒ ((1 2 3) (4 5 6)) -- Function: -partition-all (n list) Return a new list with the items in LIST grouped into N-sized sublists. The last group may contain less than N items. (-partition-all 2 '(1 2 3 4 5 6)) - ⇒ '((1 2) (3 4) (5 6)) + ⇒ ((1 2) (3 4) (5 6)) (-partition-all 2 '(1 2 3 4 5 6 7)) - ⇒ '((1 2) (3 4) (5 6) (7)) + ⇒ ((1 2) (3 4) (5 6) (7)) (-partition-all 3 '(1 2 3 4 5 6 7)) - ⇒ '((1 2 3) (4 5 6) (7)) + ⇒ ((1 2 3) (4 5 6) (7)) -- Function: -partition-in-steps (n step list) Return a new list with the items in LIST grouped into N-sized @@ -1336,11 +1375,11 @@ Functions partitioning the input list into a list of lists. make the last group N-sized, those items are discarded. (-partition-in-steps 2 1 '(1 2 3 4)) - ⇒ '((1 2) (2 3) (3 4)) + ⇒ ((1 2) (2 3) (3 4)) (-partition-in-steps 3 2 '(1 2 3 4)) - ⇒ '((1 2 3)) + ⇒ ((1 2 3)) (-partition-in-steps 3 2 '(1 2 3 4 5)) - ⇒ '((1 2 3) (3 4 5)) + ⇒ ((1 2 3) (3 4 5)) -- Function: -partition-all-in-steps (n step list) Return a new list with the items in LIST grouped into N-sized @@ -1348,22 +1387,22 @@ Functions partitioning the input list into a list of lists. than N items. (-partition-all-in-steps 2 1 '(1 2 3 4)) - ⇒ '((1 2) (2 3) (3 4) (4)) + ⇒ ((1 2) (2 3) (3 4) (4)) (-partition-all-in-steps 3 2 '(1 2 3 4)) - ⇒ '((1 2 3) (3 4)) + ⇒ ((1 2 3) (3 4)) (-partition-all-in-steps 3 2 '(1 2 3 4 5)) - ⇒ '((1 2 3) (3 4 5) (5)) + ⇒ ((1 2 3) (3 4 5) (5)) -- Function: -partition-by (fn list) Apply FN to each item in LIST, splitting it each time FN returns a new value. - (-partition-by 'even? '()) - ⇒ '() + (-partition-by 'even? ()) + ⇒ () (-partition-by 'even? '(1 1 2 2 2 3 4 6 8)) - ⇒ '((1 1) (2 2 2) (3) (4 6 8)) + ⇒ ((1 1) (2 2 2) (3) (4 6 8)) (--partition-by (< it 3) '(1 2 3 4 3 2 1)) - ⇒ '((1 2) (3 4 3) (2 1)) + ⇒ ((1 2) (3 4 3) (2 1)) -- Function: -partition-by-header (fn list) Apply FN to the first item in LIST. That is the header value. @@ -1372,64 +1411,64 @@ Functions partitioning the input list into a list of lists. (the body). (--partition-by-header (= it 1) '(1 2 3 1 2 1 2 3 4)) - ⇒ '((1 2 3) (1 2) (1 2 3 4)) + ⇒ ((1 2 3) (1 2) (1 2 3 4)) (--partition-by-header (> it 0) '(1 2 0 1 0 1 2 3 0)) - ⇒ '((1 2 0) (1 0) (1 2 3 0)) + ⇒ ((1 2 0) (1 0) (1 2 3 0)) (-partition-by-header 'even? '(2 1 1 1 4 1 3 5 6 6 1)) - ⇒ '((2 1 1 1) (4 1 3 5) (6 6 1)) + ⇒ ((2 1 1 1) (4 1 3 5) (6 6 1)) -- Function: -partition-after-pred (pred list) Partition directly after each time PRED is true on an element of LIST. - (-partition-after-pred #'odd? '()) - ⇒ '() - (-partition-after-pred #'odd? '(1)) - ⇒ '((1)) - (-partition-after-pred #'odd? '(0 1)) - ⇒ '((0 1)) + (-partition-after-pred #'booleanp ()) + ⇒ () + (-partition-after-pred #'booleanp '(t t)) + ⇒ ((t) (t)) + (-partition-after-pred #'booleanp '(0 0 t t 0 t)) + ⇒ ((0 0 t) (t) (0 t)) -- Function: -partition-before-pred (pred list) Partition directly before each time PRED is true on an element of LIST. - (-partition-before-pred #'odd? '()) - ⇒ '() - (-partition-before-pred #'odd? '(1)) - ⇒ '((1)) - (-partition-before-pred #'odd? '(0 1)) - ⇒ '((0) (1)) + (-partition-before-pred #'booleanp ()) + ⇒ () + (-partition-before-pred #'booleanp '(0 t)) + ⇒ ((0) (t)) + (-partition-before-pred #'booleanp '(0 0 t 0 t t)) + ⇒ ((0 0) (t 0) (t) (t)) -- Function: -partition-before-item (item list) Partition directly before each time ITEM appears in LIST. - (-partition-before-item 3 '()) - ⇒ '() + (-partition-before-item 3 ()) + ⇒ () (-partition-before-item 3 '(1)) - ⇒ '((1)) + ⇒ ((1)) (-partition-before-item 3 '(3)) - ⇒ '((3)) + ⇒ ((3)) -- Function: -partition-after-item (item list) Partition directly after each time ITEM appears in LIST. - (-partition-after-item 3 '()) - ⇒ '() + (-partition-after-item 3 ()) + ⇒ () (-partition-after-item 3 '(1)) - ⇒ '((1)) + ⇒ ((1)) (-partition-after-item 3 '(3)) - ⇒ '((3)) + ⇒ ((3)) -- Function: -group-by (fn list) Separate LIST into an alist whose keys are FN applied to the elements of LIST. Keys are compared by ‘equal’. - (-group-by 'even? '()) - ⇒ '() + (-group-by 'even? ()) + ⇒ () (-group-by 'even? '(1 1 2 2 2 3 4 6 8)) - ⇒ '((nil 1 1 3) (t 2 2 2 4 6 8)) + ⇒ ((nil 1 1 3) (t 2 2 2 4 6 8)) (--group-by (car (split-string it "/")) '("a/b" "c/d" "a/e")) - ⇒ '(("a" "a/b" "a/e") ("c" "c/d")) + ⇒ (("a" "a/b" "a/e") ("c" "c/d"))  File: dash.info, Node: Indexing, Next: Set operations, Prev: Partitioning, Up: Functions @@ -1437,8 +1476,8 @@ File: dash.info, Node: Indexing, Next: Set operations, Prev: Partitioning, U 2.8 Indexing ============ -Return indices of elements based on predicates, sort elements by indices -etc. +Functions retrieving or sorting based on list indices and related +predicates. -- Function: -elem-index (elem list) Return the index of the first element in the given LIST which is @@ -1457,11 +1496,11 @@ etc. element ELEM, in ascending order. (-elem-indices 2 '(6 7 8 2 3 4 2 1)) - ⇒ '(3 6) + ⇒ (3 6) (-elem-indices "bar" '("foo" "bar" "baz")) - ⇒ '(1) + ⇒ (1) (-elem-indices '(1 2) '((3) (1 2) (5 6) (1 2) nil)) - ⇒ '(1 3) + ⇒ (1 3) -- Function: -find-index (pred list) Take a predicate PRED and a LIST and return the index of the first @@ -1496,11 +1535,11 @@ etc. PRED, in ascending order. (-find-indices 'even? '(2 4 1 6 3 3 5 8)) - ⇒ '(0 1 3 7) + ⇒ (0 1 3 7) (--find-indices (< 5 it) '(2 4 1 6 3 3 5 8)) - ⇒ '(3 7) + ⇒ (3 7) (-find-indices (-partial 'string-lessp "baz") '("bar" "foo" "baz")) - ⇒ '(1) + ⇒ (1) -- Function: -grade-up (comparator list) Grade elements of LIST using COMPARATOR relation. This yields a @@ -1508,9 +1547,9 @@ etc. sorts it in ascending order. (-grade-up #'< '(3 1 4 2 1 3 3)) - ⇒ '(1 4 3 0 5 6 2) + ⇒ (1 4 3 0 5 6 2) (let ((l '(3 1 4 2 1 3 3))) (-select-by-indices (-grade-up #'< l) l)) - ⇒ '(1 1 2 3 3 3 4) + ⇒ (1 1 2 3 3 3 4) -- Function: -grade-down (comparator list) Grade elements of LIST using COMPARATOR relation. This yields a @@ -1518,9 +1557,9 @@ etc. sorts it in descending order. (-grade-down #'< '(3 1 4 2 1 3 3)) - ⇒ '(2 0 5 6 3 1 4) + ⇒ (2 0 5 6 3 1 4) (let ((l '(3 1 4 2 1 3 3))) (-select-by-indices (-grade-down #'< l) l)) - ⇒ '(4 3 3 3 2 1 1) + ⇒ (4 3 3 3 2 1 1)  File: dash.info, Node: Set operations, Next: Other list operations, Prev: Indexing, Up: Functions @@ -1536,53 +1575,53 @@ Operations pretending lists are sets. ‘equal’, or with ‘-compare-fn’ if that’s non-nil. (-union '(1 2 3) '(3 4 5)) - ⇒ '(1 2 3 4 5) - (-union '(1 2 3 4) '()) - ⇒ '(1 2 3 4) + ⇒ (1 2 3 4 5) + (-union '(1 2 3 4) ()) + ⇒ (1 2 3 4) (-union '(1 1 2 2) '(3 2 1)) - ⇒ '(1 1 2 2 3) + ⇒ (1 1 2 2 3) -- Function: -difference (list list2) Return a new list with only the members of LIST that are not in LIST2. The test for equality is done with ‘equal’, or with ‘-compare-fn’ if that’s non-nil. - (-difference '() '()) - ⇒ '() + (-difference () ()) + ⇒ () (-difference '(1 2 3) '(4 5 6)) - ⇒ '(1 2 3) + ⇒ (1 2 3) (-difference '(1 2 3 4) '(3 4 5 6)) - ⇒ '(1 2) + ⇒ (1 2) -- Function: -intersection (list list2) Return a new list containing only the elements that are members of both LIST and LIST2. The test for equality is done with ‘equal’, or with ‘-compare-fn’ if that’s non-nil. - (-intersection '() '()) - ⇒ '() + (-intersection () ()) + ⇒ () (-intersection '(1 2 3) '(4 5 6)) - ⇒ '() + ⇒ () (-intersection '(1 2 3 4) '(3 4 5 6)) - ⇒ '(3 4) + ⇒ (3 4) -- Function: -powerset (list) Return the power set of LIST. - (-powerset '()) - ⇒ '(nil) + (-powerset ()) + ⇒ (nil) (-powerset '(x y z)) - ⇒ '((x y z) (x y) (x z) (x) (y z) (y) (z) nil) + ⇒ ((x y z) (x y) (x z) (x) (y z) (y) (z) nil) -- Function: -permutations (list) Return the permutations of LIST. - (-permutations '()) - ⇒ '(nil) + (-permutations ()) + ⇒ (nil) (-permutations '(1 2)) - ⇒ '((1 2) (2 1)) + ⇒ ((1 2) (2 1)) (-permutations '(a b c)) - ⇒ '((a b c) (a c b) (b a c) (b c a) (c a b) (c b a)) + ⇒ ((a b c) (a c b) (b a c) (b c a) (c a b) (c b a)) -- Function: -distinct (list) Return a new list with all duplicates removed. The test for @@ -1591,12 +1630,12 @@ Operations pretending lists are sets. Alias: ‘-uniq’ - (-distinct '()) - ⇒ '() + (-distinct ()) + ⇒ () (-distinct '(1 2 2 4)) - ⇒ '(1 2 4) + ⇒ (1 2 4) (-distinct '(t t t)) - ⇒ '(t) + ⇒ (t)  File: dash.info, Node: Other list operations, Next: Tree operations, Prev: Set operations, Up: Functions @@ -1611,20 +1650,20 @@ Other list functions not fit to be classified elsewhere. left. The time complexity is O(n). (-rotate 3 '(1 2 3 4 5 6 7)) - ⇒ '(5 6 7 1 2 3 4) + ⇒ (5 6 7 1 2 3 4) (-rotate -3 '(1 2 3 4 5 6 7)) - ⇒ '(4 5 6 7 1 2 3) + ⇒ (4 5 6 7 1 2 3) (-rotate 16 '(1 2 3 4 5 6 7)) - ⇒ '(6 7 1 2 3 4 5) + ⇒ (6 7 1 2 3 4 5) -- Function: -repeat (n x) Return a new list of length N with each element being X. Return nil if N is less than 1. (-repeat 3 :a) - ⇒ '(:a :a :a) + ⇒ (:a :a :a) (-repeat 1 :a) - ⇒ '(:a) + ⇒ (:a) (-repeat 0 :a) ⇒ nil @@ -1635,9 +1674,9 @@ Other list functions not fit to be classified elsewhere. no ARGS, return nil. (-cons* 1 2) - ⇒ '(1 . 2) + ⇒ (1 . 2) (-cons* 1 2 3) - ⇒ '(1 2 . 3) + ⇒ (1 2 . 3) (-cons* 1) ⇒ 1 @@ -1649,32 +1688,32 @@ Other list functions not fit to be classified elsewhere. If ELEMENTS is non nil, append these to the list as well. (-snoc '(1 2 3) 4) - ⇒ '(1 2 3 4) + ⇒ (1 2 3 4) (-snoc '(1 2 3) 4 5 6) - ⇒ '(1 2 3 4 5 6) + ⇒ (1 2 3 4 5 6) (-snoc '(1 2 3) '(4 5 6)) - ⇒ '(1 2 3 (4 5 6)) + ⇒ (1 2 3 (4 5 6)) -- Function: -interpose (sep list) Return a new list of all elements in LIST separated by SEP. - (-interpose "-" '()) - ⇒ '() + (-interpose "-" ()) + ⇒ () (-interpose "-" '("a")) - ⇒ '("a") + ⇒ ("a") (-interpose "-" '("a" "b" "c")) - ⇒ '("a" "-" "b" "-" "c") + ⇒ ("a" "-" "b" "-" "c") -- Function: -interleave (&rest lists) Return a new list of the first item in each list, then the second etc. (-interleave '(1 2) '("a" "b")) - ⇒ '(1 "a" 2 "b") + ⇒ (1 "a" 2 "b") (-interleave '(1 2) '("a" "b") '("A" "B")) - ⇒ '(1 "a" "A" 2 "b" "B") + ⇒ (1 "a" "A" 2 "b" "B") (-interleave '(1 2 3) '("a" "b")) - ⇒ '(1 "a" 2 "b") + ⇒ (1 "a" 2 "b") -- Function: -iota (count &optional start step) Return a list containing COUNT numbers. Starts from START and adds @@ -1683,11 +1722,11 @@ Other list functions not fit to be classified elsewhere. the APL language. (-iota 6) - ⇒ '(0 1 2 3 4 5) + ⇒ (0 1 2 3 4 5) (-iota 4 2.5 -2) - ⇒ '(2.5 0.5 -1.5 -3.5) + ⇒ (2.5 0.5 -1.5 -3.5) (-iota -1) - error→ "Wrong type argument: natnump, -1" + error→ Wrong type argument: natnump, -1 -- Function: -zip-with (fn list1 list2) Zip the two lists LIST1 and LIST2 using a function FN. This @@ -1699,11 +1738,11 @@ Other list functions not fit to be classified elsewhere. symbol ‘it’, and the elements from LIST2 as symbol ‘other’. (-zip-with '+ '(1 2 3) '(4 5 6)) - ⇒ '(5 7 9) + ⇒ (5 7 9) (-zip-with 'cons '(1 2 3) '(4 5 6)) - ⇒ '((1 . 4) (2 . 5) (3 . 6)) + ⇒ ((1 . 4) (2 . 5) (3 . 6)) (--zip-with (concat it " and " other) '("Batman" "Jekyll") '("Robin" "Hyde")) - ⇒ '("Batman and Robin" "Jekyll and Hyde") + ⇒ ("Batman and Robin" "Jekyll and Hyde") -- Function: -zip (&rest lists) Zip LISTS together. Group the head of each list, followed by the @@ -1723,11 +1762,11 @@ Other list functions not fit to be classified elsewhere. See also: ‘-zip-lists’ (*note -zip-lists::) (-zip '(1 2 3) '(4 5 6)) - ⇒ '((1 . 4) (2 . 5) (3 . 6)) + ⇒ ((1 . 4) (2 . 5) (3 . 6)) (-zip '(1 2 3) '(4 5 6 7)) - ⇒ '((1 . 4) (2 . 5) (3 . 6)) + ⇒ ((1 . 4) (2 . 5) (3 . 6)) (-zip '(1 2) '(3 4 5) '(6)) - ⇒ '((1 3 6)) + ⇒ ((1 3 6)) -- Function: -zip-lists (&rest lists) Zip LISTS together. Group the head of each list, followed by the @@ -1742,11 +1781,11 @@ Other list functions not fit to be classified elsewhere. See also: ‘-zip’ (*note -zip::) (-zip-lists '(1 2 3) '(4 5 6)) - ⇒ '((1 4) (2 5) (3 6)) + ⇒ ((1 4) (2 5) (3 6)) (-zip-lists '(1 2 3) '(4 5 6 7)) - ⇒ '((1 4) (2 5) (3 6)) + ⇒ ((1 4) (2 5) (3 6)) (-zip-lists '(1 2) '(3 4 5) '(6)) - ⇒ '((1 3 6)) + ⇒ ((1 3 6)) -- Function: -zip-fill (fill-value &rest lists) Zip LISTS, with FILL-VALUE padded onto the shorter lists. The @@ -1754,7 +1793,7 @@ Other list functions not fit to be classified elsewhere. longest input list. (-zip-fill 0 '(1 2 3 4 5) '(6 7 8 9)) - ⇒ '((1 . 6) (2 . 7) (3 . 8) (4 . 9) (5 . 0)) + ⇒ ((1 . 6) (2 . 7) (3 . 8) (4 . 9) (5 . 0)) -- Function: -unzip (lists) Unzip LISTS. @@ -1772,33 +1811,33 @@ Other list functions not fit to be classified elsewhere. See also: ‘-zip’ (*note -zip::) (-unzip (-zip '(1 2 3) '(a b c) '("e" "f" "g"))) - ⇒ '((1 2 3) (a b c) ("e" "f" "g")) + ⇒ ((1 2 3) (a b c) ("e" "f" "g")) (-unzip '((1 2) (3 4) (5 6) (7 8) (9 10))) - ⇒ '((1 3 5 7 9) (2 4 6 8 10)) + ⇒ ((1 3 5 7 9) (2 4 6 8 10)) (-unzip '((1 2) (3 4))) - ⇒ '((1 . 3) (2 . 4)) + ⇒ ((1 . 3) (2 . 4)) -- Function: -cycle (list) Return an infinite circular copy of LIST. The returned list cycles through the elements of LIST and repeats from the beginning. (-take 5 (-cycle '(1 2 3))) - ⇒ '(1 2 3 1 2) + ⇒ (1 2 3 1 2) (-take 7 (-cycle '(1 "and" 3))) - ⇒ '(1 "and" 3 1 "and" 3 1) + ⇒ (1 "and" 3 1 "and" 3 1) (-zip (-cycle '(1 2 3)) '(1 2)) - ⇒ '((1 . 1) (2 . 2)) + ⇒ ((1 . 1) (2 . 2)) -- Function: -pad (fill-value &rest lists) Appends FILL-VALUE to the end of each list in LISTS such that they will all have the same length. - (-pad 0 '()) - ⇒ '(nil) + (-pad 0 ()) + ⇒ (nil) (-pad 0 '(1)) - ⇒ '((1)) + ⇒ ((1)) (-pad 0 '(1 2 3) '(4 5)) - ⇒ '((1 2 3) (4 5 0)) + ⇒ ((1 2 3) (4 5 0)) -- Function: -table (fn &rest lists) Compute outer product of LISTS using function FN. @@ -1813,11 +1852,11 @@ Other list functions not fit to be classified elsewhere. See also: ‘-table-flat’ (*note -table-flat::) (-table '* '(1 2 3) '(1 2 3)) - ⇒ '((1 2 3) (2 4 6) (3 6 9)) + ⇒ ((1 2 3) (2 4 6) (3 6 9)) (-table (lambda (a b) (-sum (-zip-with '* a b))) '((1 2) (3 4)) '((1 3) (2 4))) - ⇒ '((7 15) (10 22)) + ⇒ ((7 15) (10 22)) (apply '-table 'list (-repeat 3 '(1 2))) - ⇒ '((((1 1 1) (2 1 1)) ((1 2 1) (2 2 1))) (((1 1 2) (2 1 2)) ((1 2 2) (2 2 2)))) + ⇒ ((((1 1 1) (2 1 1)) ((1 2 1) (2 2 1))) (((1 1 2) (2 1 2)) ((1 2 2) (2 2 2)))) -- Function: -table-flat (fn &rest lists) Compute flat outer product of LISTS using function FN. @@ -1838,17 +1877,20 @@ Other list functions not fit to be classified elsewhere. -table::) (-table-flat 'list '(1 2 3) '(a b c)) - ⇒ '((1 a) (2 a) (3 a) (1 b) (2 b) (3 b) (1 c) (2 c) (3 c)) + ⇒ ((1 a) (2 a) (3 a) (1 b) (2 b) (3 b) (1 c) (2 c) (3 c)) (-table-flat '* '(1 2 3) '(1 2 3)) - ⇒ '(1 2 3 2 4 6 3 6 9) + ⇒ (1 2 3 2 4 6 3 6 9) (apply '-table-flat 'list (-repeat 3 '(1 2))) - ⇒ '((1 1 1) (2 1 1) (1 2 1) (2 2 1) (1 1 2) (2 1 2) (1 2 2) (2 2 2)) + ⇒ ((1 1 1) (2 1 1) (1 2 1) (2 2 1) (1 1 2) (2 1 2) (1 2 2) (2 2 2)) -- Function: -first (pred list) Return the first item in LIST for which PRED returns non-nil. Return nil if no such element is found. To get the first item in - the list no questions asked, use ‘car’. Alias: ‘-find’. This - function’s anaphoric counterpart is ‘--first’. + the list no questions asked, use ‘car’. + + Alias: ‘-find’. + + This function’s anaphoric counterpart is ‘--first’. (-first #'natnump '(-1 0 1)) ⇒ 0 @@ -1859,15 +1901,18 @@ Other list functions not fit to be classified elsewhere. -- Function: -some (pred list) Return (PRED x) for the first LIST item where (PRED x) is non-nil, - else nil. Alias: ‘-any’. This function’s anaphoric counterpart is - ‘--some’. + else nil. + + Alias: ‘-any’. + + This function’s anaphoric counterpart is ‘--some’. (-some (lambda (s) (string-match-p "x" s)) '("foo" "axe" "xor")) ⇒ 1 (-some (lambda (s) (string-match-p "x" s)) '("foo" "bar" "baz")) ⇒ nil (--some (member 'foo it) '((foo bar) (baz))) - ⇒ '(foo bar) + ⇒ (foo bar) -- Function: -last (pred list) Return the last x in LIST where (PRED x) is non-nil, else nil. @@ -1885,34 +1930,28 @@ Other list functions not fit to be classified elsewhere. See also: ‘-second-item’ (*note -second-item::), ‘-last-item’ (*note -last-item::). - (fn LIST) - (-first-item '(1 2 3)) ⇒ 1 (-first-item nil) ⇒ nil (let ((list (list 1 2 3))) (setf (-first-item list) 5) list) - ⇒ '(5 2 3) + ⇒ (5 2 3) - -- Function: -second-item (arg1) + -- Function: -second-item (list) Return the second item of LIST, or nil if LIST is too short. See also: ‘-third-item’ (*note -third-item::). - (fn LIST) - (-second-item '(1 2 3)) ⇒ 2 (-second-item nil) ⇒ nil - -- Function: -third-item (arg1) + -- Function: -third-item (list) Return the third item of LIST, or nil if LIST is too short. See also: ‘-fourth-item’ (*note -fourth-item::). - (fn LIST) - (-third-item '(1 2 3)) ⇒ 3 (-third-item nil) @@ -1946,15 +1985,15 @@ Other list functions not fit to be classified elsewhere. (-last-item nil) ⇒ nil (let ((list (list 1 2 3))) (setf (-last-item list) 5) list) - ⇒ '(1 2 5) + ⇒ (1 2 5) -- Function: -butlast (list) Return a list of all items in list except for the last. (-butlast '(1 2 3)) - ⇒ '(1 2) + ⇒ (1 2) (-butlast '(1 2)) - ⇒ '(1) + ⇒ (1) (-butlast '(1)) ⇒ nil @@ -1965,13 +2004,13 @@ Other list functions not fit to be classified elsewhere. first element should sort before the second. (-sort '< '(3 1 2)) - ⇒ '(1 2 3) + ⇒ (1 2 3) (-sort '> '(3 1 2)) - ⇒ '(3 2 1) + ⇒ (3 2 1) (--sort (< it other) '(3 1 2)) - ⇒ '(1 2 3) + ⇒ (1 2 3) - -- Function: -list (&optional arg &rest args) + -- Function: -list (arg) Ensure ARG is a list. If ARG is already a list, return it as is (not a copy). Otherwise, return a new list with ARG as its only element. @@ -1982,11 +2021,11 @@ Other list functions not fit to be classified elsewhere. compatibility and is otherwise deprecated. (-list 1) - ⇒ '(1) - (-list nil) - ⇒ nil + ⇒ (1) + (-list ()) + ⇒ () (-list '(1 2 3)) - ⇒ '(1 2 3) + ⇒ (1 2 3) -- Function: -fix (fn list) Compute the (least) fixpoint of FN with initial input LIST. @@ -1994,9 +2033,9 @@ Other list functions not fit to be classified elsewhere. FN is called at least once, results are compared with ‘equal’. (-fix (lambda (l) (-non-nil (--mapcat (-split-at (/ (length it) 2) it) l))) '((1 2 3))) - ⇒ '((1) (2) (3)) + ⇒ ((1) (2) (3)) (let ((l '((starwars scifi) (jedi starwars warrior)))) (--fix (-uniq (--mapcat (cons it (cdr (assq it l))) it)) '(jedi book))) - ⇒ '(jedi starwars warrior scifi book) + ⇒ (jedi starwars warrior scifi book)  File: dash.info, Node: Tree operations, Next: Threading macros, Prev: Other list operations, Up: Functions @@ -2020,22 +2059,22 @@ Functions pretending lists are trees. Non-branch nodes are simply copied. (-tree-seq 'listp 'identity '(1 (2 3) 4 (5 (6 7)))) - ⇒ '((1 (2 3) 4 (5 (6 7))) 1 (2 3) 2 3 4 (5 (6 7)) 5 (6 7) 6 7) + ⇒ ((1 (2 3) 4 (5 (6 7))) 1 (2 3) 2 3 4 (5 (6 7)) 5 (6 7) 6 7) (-tree-seq 'listp 'reverse '(1 (2 3) 4 (5 (6 7)))) - ⇒ '((1 (2 3) 4 (5 (6 7))) (5 (6 7)) (6 7) 7 6 5 4 (2 3) 3 2 1) + ⇒ ((1 (2 3) 4 (5 (6 7))) (5 (6 7)) (6 7) 7 6 5 4 (2 3) 3 2 1) (--tree-seq (vectorp it) (append it nil) [1 [2 3] 4 [5 [6 7]]]) - ⇒ '([1 [2 3] 4 [5 [6 7]]] 1 [2 3] 2 3 4 [5 [6 7]] 5 [6 7] 6 7) + ⇒ ([1 [2 3] 4 [5 [6 7]]] 1 [2 3] 2 3 4 [5 [6 7]] 5 [6 7] 6 7) -- Function: -tree-map (fn tree) Apply FN to each element of TREE while preserving the tree structure. (-tree-map '1+ '(1 (2 3) (4 (5 6) 7))) - ⇒ '(2 (3 4) (5 (6 7) 8)) + ⇒ (2 (3 4) (5 (6 7) 8)) (-tree-map '(lambda (x) (cons x (expt 2 x))) '(1 (2 3) 4)) - ⇒ '((1 . 2) ((2 . 4) (3 . 8)) (4 . 16)) + ⇒ ((1 . 2) ((2 . 4) (3 . 8)) (4 . 16)) (--tree-map (length it) '("" ("

" "text" "

") "")) - ⇒ '(6 (3 4 4) 7) + ⇒ (6 (3 4 4) 7) -- Function: -tree-map-nodes (pred fun tree) Call FUN on each node of TREE that satisfies PRED. @@ -2044,11 +2083,11 @@ Functions pretending lists are trees. returns non-nil, apply FUN to this node and do not descend further. (-tree-map-nodes 'vectorp (lambda (x) (-sum (append x nil))) '(1 [2 3] 4 (5 [6 7] 8))) - ⇒ '(1 5 4 (5 13 8)) + ⇒ (1 5 4 (5 13 8)) (-tree-map-nodes 'keywordp (lambda (x) (symbol-name x)) '(1 :foo 4 ((5 6 :bar) :baz 8))) - ⇒ '(1 ":foo" 4 ((5 6 ":bar") ":baz" 8)) + ⇒ (1 ":foo" 4 ((5 6 ":bar") ":baz" 8)) (--tree-map-nodes (eq (car-safe it) 'add-mode) (-concat it (list :mode 'emacs-lisp-mode)) '(with-mode emacs-lisp-mode (foo bar) (add-mode a b) (baz (add-mode c d)))) - ⇒ '(with-mode emacs-lisp-mode (foo bar) (add-mode a b :mode emacs-lisp-mode) (baz (add-mode c d :mode emacs-lisp-mode))) + ⇒ (with-mode emacs-lisp-mode (foo bar) (add-mode a b :mode emacs-lisp-mode) (baz (add-mode c d :mode emacs-lisp-mode))) -- Function: -tree-reduce (fn tree) Use FN to reduce elements of list TREE. If elements of TREE are @@ -2080,7 +2119,7 @@ Functions pretending lists are trees. (-tree-reduce-from '+ 1 '(1 (1 1) ((1)))) ⇒ 8 (--tree-reduce-from (-concat acc (list it)) nil '(1 (2 3 (4 5)) (6 7))) - ⇒ '((7 6) ((5 4) 3 2) 1) + ⇒ ((7 6) ((5 4) 3 2) 1) -- Function: -tree-mapreduce (fn folder tree) Apply FN to each element of TREE, and make a list of the results. @@ -2095,7 +2134,7 @@ Functions pretending lists are trees. only traverse the structure once. (-tree-mapreduce 'list 'append '(1 (2 (3 4) (5 6)) (7 (8 9)))) - ⇒ '(1 2 3 4 5 6 7 8 9) + ⇒ (1 2 3 4 5 6 7 8 9) (--tree-mapreduce 1 (+ it acc) '(1 (2 (4 9) (2 1)) (7 (4 3)))) ⇒ 9 (--tree-mapreduce 0 (max acc (1+ it)) '(1 (2 (4 9) (2 1)) (7 (4 3)))) @@ -2116,9 +2155,9 @@ Functions pretending lists are trees. (-tree-mapreduce-from 'identity '* 1 '(1 (2 (3 4) (5 6)) (7 (8 9)))) ⇒ 362880 (--tree-mapreduce-from (+ it it) (cons it acc) nil '(1 (2 (4 9) (2 1)) (7 (4 3)))) - ⇒ '(2 (4 (8 18) (4 2)) (14 (8 6))) - (concat "{" (--tree-mapreduce-from (cond ((-cons-pair? it) (concat (symbol-name (car it)) " -> " (symbol-name (cdr it)))) (t (concat (symbol-name it) " : {"))) (concat it (unless (or (equal acc "}") (equal (substring it (1- (length it))) "{")) ", ") acc) "}" '((elips-mode (foo (bar . booze)) (baz . qux)) (c-mode (foo . bla) (bum . bam))))) - ⇒ "{elips-mode : {foo : {bar -> booze{, baz -> qux{, c-mode : {foo -> bla, bum -> bam}}" + ⇒ (2 (4 (8 18) (4 2)) (14 (8 6))) + (concat "{" (--tree-mapreduce-from (cond ((-cons-pair? it) (concat (symbol-name (car it)) " -> " (symbol-name (cdr it)))) (t (concat (symbol-name it) " : {"))) (concat it (unless (or (equal acc "}") (equal (substring it (1- (length it))) "{")) ", ") acc) "}" '((elisp-mode (foo (bar . booze)) (baz . qux)) (c-mode (foo . bla) (bum . bam))))) + ⇒ "{elisp-mode : {foo : {bar -> booze}, baz -> qux}, c-mode : {foo -> bla, bum -> bam}}" -- Function: -clone (list) Create a deep copy of LIST. The new list has the same elements and @@ -2126,7 +2165,7 @@ Functions pretending lists are trees. when you need to clone a structure such as plist or alist. (let* ((a '(1 2 3)) (b (-clone a))) (nreverse a) b) - ⇒ '(1 2 3) + ⇒ (1 2 3)  File: dash.info, Node: Threading macros, Next: Binding, Prev: Tree operations, Up: Functions @@ -2134,6 +2173,9 @@ File: dash.info, Node: Threading macros, Next: Binding, Prev: Tree operations 2.12 Threading macros ===================== +Macros that conditionally combine sequential forms for brevity or +readability. + -- Macro: -> (x &optional form &rest more) Thread the expr through the forms. Insert X as the second item in the first form, making a list of it if it is not a list already. @@ -2141,11 +2183,11 @@ File: dash.info, Node: Threading macros, Next: Binding, Prev: Tree operations in second form, etc. (-> '(2 3 5)) - ⇒ '(2 3 5) + ⇒ (2 3 5) (-> '(2 3 5) (append '(8 13))) - ⇒ '(2 3 5 8 13) + ⇒ (2 3 5 8 13) (-> '(2 3 5) (append '(8 13)) (-slice 1 -1)) - ⇒ '(3 5 8) + ⇒ (3 5 8) -- Macro: ->> (x &optional form &rest more) Thread the expr through the forms. Insert X as the last item in @@ -2154,9 +2196,9 @@ File: dash.info, Node: Threading macros, Next: Binding, Prev: Tree operations second form, etc. (->> '(1 2 3) (-map 'square)) - ⇒ '(1 4 9) + ⇒ (1 4 9) (->> '(1 2 3) (-map 'square) (-remove 'even?)) - ⇒ '(1 9) + ⇒ (1 9) (->> '(1 2 3) (-map 'square) (-reduce '+)) ⇒ 14 @@ -2181,7 +2223,7 @@ File: dash.info, Node: Threading macros, Next: Binding, Prev: Tree operations bind VARIABLE to the result of the first form, and so forth. (-as-> 3 my-var (1+ my-var) (list my-var) (mapcar (lambda (ele) (* 2 ele)) my-var)) - ⇒ '(8) + ⇒ (8) (-as-> 3 my-var 1+) ⇒ 4 (-as-> 3 my-var) @@ -2193,7 +2235,7 @@ File: dash.info, Node: Threading macros, Next: Binding, Prev: Tree operations form, etc. (-some-> '(2 3 5)) - ⇒ '(2 3 5) + ⇒ (2 3 5) (-some-> 5 square) ⇒ 25 (-some-> 5 even? square) @@ -2205,23 +2247,24 @@ File: dash.info, Node: Threading macros, Next: Binding, Prev: Tree operations form, etc. (-some->> '(1 2 3) (-map 'square)) - ⇒ '(1 4 9) + ⇒ (1 4 9) (-some->> '(1 3 5) (-last 'even?) (+ 100)) ⇒ nil (-some->> '(2 4 6) (-last 'even?) (+ 100)) ⇒ 106 - -- Macro: -some--> (x &optional form &rest more) - When expr is non-nil, thread it through the first form (via ‘-->’ - (*note -->::)), and when that result is non-nil, through the next - form, etc. + -- Macro: -some--> (expr &rest forms) + Thread EXPR through FORMS via ‘-->’ (*note -->::), while the result + is non-nil. When EXPR evaluates to non-nil, thread the result + through the first of FORMS, and when that result is non-nil, thread + it through the next form, etc. (-some--> "def" (concat "abc" it "ghi")) ⇒ "abcdefghi" (-some--> nil (concat "abc" it "ghi")) ⇒ nil - (-some--> '(1 3 5) (-filter 'even? it) (append it it) (-map 'square it)) - ⇒ nil + (-some--> '(0 1) (-remove #'natnump it) (append it it) (-map #'1+ it)) + ⇒ () -- Macro: -doto (init &rest forms) Evaluate INIT and pass it as argument to FORMS with ‘->’ (*note @@ -2230,11 +2273,11 @@ File: dash.info, Node: Threading macros, Next: Binding, Prev: Tree operations value is RESULT, which FORMS may have modified by side effect. (-doto (list 1 2 3) pop pop) - ⇒ '(3) + ⇒ (3) (-doto (cons 1 2) (setcar 3) (setcdr 4)) - ⇒ '(3 . 4) + ⇒ (3 . 4) (gethash 'k (--doto (make-hash-table) (puthash 'k 'v it))) - ⇒ 'v + ⇒ v  File: dash.info, Node: Binding, Next: Side effects, Prev: Threading macros, Up: Functions @@ -2242,16 +2285,14 @@ File: dash.info, Node: Binding, Next: Side effects, Prev: Threading macros, 2.13 Binding ============ -Convenient versions of ‘let‘ and ‘let*‘ constructs combined with flow +Macros that combine ‘let’ and ‘let*’ with destructuring and flow control. - -- Macro: -when-let (var-val &rest body) + -- Macro: -when-let ((var val) &rest body) If VAL evaluates to non-nil, bind it to VAR and execute body. Note: binding is done according to ‘-let’ (*note -let::). - (fn (VAR VAL) &rest BODY) - (-when-let (match-index (string-match "d" "abcd")) (+ match-index 2)) ⇒ 5 (-when-let ((&plist :foo foo) (list :foo "foo")) foo) @@ -2272,14 +2313,12 @@ control. (-when-let* ((x 5) (y nil) (z 7)) (+ x y z)) ⇒ nil - -- Macro: -if-let (var-val then &rest else) + -- Macro: -if-let ((var val) then &rest else) If VAL evaluates to non-nil, bind it to VAR and do THEN, otherwise do ELSE. Note: binding is done according to ‘-let’ (*note -let::). - (fn (VAR VAL) THEN &rest ELSE) - (-if-let (match-index (string-match "d" "abc")) (+ match-index 3) 7) ⇒ 7 (--if-let (even? 4) it nil) @@ -2461,11 +2500,11 @@ control. because we need to support improper list binding. (-let (([a (b c) d] [1 (2 3) 4])) (list a b c d)) - ⇒ '(1 2 3 4) + ⇒ (1 2 3 4) (-let [(a b c . d) (list 1 2 3 4 5 6)] (list a b c d)) - ⇒ '(1 2 3 (4 5 6)) + ⇒ (1 2 3 (4 5 6)) (-let [(&plist :foo foo :bar bar) (list :baz 3 :foo 1 :qux 4 :bar 2)] (list foo bar)) - ⇒ '(1 2) + ⇒ (1 2) -- Macro: -let* (varlist &rest body) Bind variables according to VARLIST then eval BODY. @@ -2481,11 +2520,11 @@ control. See ‘-let’ (*note -let::) for the list of all possible patterns. (-let* (((a . b) (cons 1 2)) ((c . d) (cons 3 4))) (list a b c d)) - ⇒ '(1 2 3 4) + ⇒ (1 2 3 4) (-let* (((a . b) (cons 1 (cons 2 3))) ((c . d) b)) (list a b c d)) - ⇒ '(1 (2 . 3) 2 3) + ⇒ (1 (2 . 3) 2 3) (-let* (((&alist "foo" foo "bar" bar) (list (cons "foo" 1) (cons "bar" (list 'a 'b 'c)))) ((a b c) bar)) (list foo a b c bar)) - ⇒ '(1 a b c (a b c)) + ⇒ (1 a b c (a b c)) -- Macro: -lambda (match-form &rest body) Return a lambda which destructures its input as MATCH-FORM and @@ -2504,13 +2543,13 @@ control. mechanism. (-map (-lambda ((x y)) (+ x y)) '((1 2) (3 4) (5 6))) - ⇒ '(3 7 11) + ⇒ (3 7 11) (-map (-lambda ([x y]) (+ x y)) '([1 2] [3 4] [5 6])) - ⇒ '(3 7 11) + ⇒ (3 7 11) (funcall (-lambda ((_ . a) (_ . b)) (-concat a b)) '(1 2 3) '(4 5 6)) - ⇒ '(2 3 5 6) + ⇒ (2 3 5 6) - -- Macro: -setq (&rest forms) + -- Macro: -setq ([match-form val] ...) Bind each MATCH-FORM to the value of its VAL. MATCH-FORM destructuring is done according to the rules of ‘-let’ @@ -2528,12 +2567,10 @@ control. Care is taken to only evaluate each VAL once so that in case of multiple assignments it does not cause unexpected side effects. - (fn [MATCH-FORM VAL]...) - (let (a) (-setq a 1) a) ⇒ 1 (let (a b) (-setq (a b) (list 1 2)) (list a b)) - ⇒ '(1 2) + ⇒ (1 2) (let (c) (-setq (&plist :c c) (list :c "c")) c) ⇒ "c" @@ -2547,14 +2584,17 @@ Functions iterating over lists for side effect only. -- Function: -each (list fn) Call FN on each element of LIST. Return nil; this function is - intended for side effects. Its anaphoric counterpart is ‘--each’. + intended for side effects. + + Its anaphoric counterpart is ‘--each’. + For access to the current element’s index in LIST, see ‘-each-indexed’ (*note -each-indexed::). (let (l) (-each '(1 2 3) (lambda (x) (push x l))) l) - ⇒ '(3 2 1) + ⇒ (3 2 1) (let (l) (--each '(1 2 3) (push it l)) l) - ⇒ '(3 2 1) + ⇒ (3 2 1) (-each '(1 2 3) #'identity) ⇒ nil @@ -2562,37 +2602,40 @@ Functions iterating over lists for side effect only. Call FN on each ITEM in LIST, while (PRED ITEM) is non-nil. Once an ITEM is reached for which PRED returns nil, FN is no longer called. Return nil; this function is intended for side effects. + Its anaphoric counterpart is ‘--each-while’. (let (l) (-each-while '(2 4 5 6) #'even? (lambda (x) (push x l))) l) - ⇒ '(4 2) + ⇒ (4 2) (let (l) (--each-while '(1 2 3 4) (< it 3) (push it l)) l) - ⇒ '(2 1) - (let ((s 0)) (--each-while '(1 3 4 5) (odd? it) (setq s (+ s it))) s) - ⇒ 4 + ⇒ (2 1) + (let ((s 0)) (--each-while '(1 3 4 5) (< it 5) (setq s (+ s it))) s) + ⇒ 8 -- Function: -each-indexed (list fn) Call FN on each index and element of LIST. For each ITEM at INDEX in LIST, call (funcall FN INDEX ITEM). Return nil; this function - is intended for side effects. See also: ‘-map-indexed’ (*note - -map-indexed::). + is intended for side effects. + + See also: ‘-map-indexed’ (*note -map-indexed::). (let (l) (-each-indexed '(a b c) (lambda (i x) (push (list x i) l))) l) - ⇒ '((c 2) (b 1) (a 0)) + ⇒ ((c 2) (b 1) (a 0)) (let (l) (--each-indexed '(a b c) (push (list it it-index) l)) l) - ⇒ '((c 2) (b 1) (a 0)) - (let (l) (--each-indexed nil (push it l)) l) - ⇒ nil + ⇒ ((c 2) (b 1) (a 0)) + (let (l) (--each-indexed () (push it l)) l) + ⇒ () -- Function: -each-r (list fn) Call FN on each element of LIST in reversed order. Return nil; - this function is intended for side effects. Its anaphoric - counterpart is ‘--each-r’. + this function is intended for side effects. + + Its anaphoric counterpart is ‘--each-r’. (let (l) (-each-r '(1 2 3) (lambda (x) (push x l))) l) - ⇒ '(1 2 3) + ⇒ (1 2 3) (let (l) (--each-r '(1 2 3) (push it l)) l) - ⇒ '(1 2 3) + ⇒ (1 2 3) (-each-r '(1 2 3) #'identity) ⇒ nil @@ -2600,27 +2643,30 @@ Functions iterating over lists for side effect only. Call FN on each ITEM in reversed LIST, while (PRED ITEM) is non-nil. Once an ITEM is reached for which PRED returns nil, FN is no longer called. Return nil; this function is intended for side - effects. Its anaphoric counterpart is ‘--each-r-while’. + effects. + + Its anaphoric counterpart is ‘--each-r-while’. (let (l) (-each-r-while '(2 4 5 6) #'even? (lambda (x) (push x l))) l) - ⇒ '(6) + ⇒ (6) (let (l) (--each-r-while '(1 2 3 4) (>= it 3) (push it l)) l) - ⇒ '(3 4) - (let ((s 0)) (--each-r-while '(1 2 3 5) (odd? it) (setq s (+ s it))) s) - ⇒ 8 + ⇒ (3 4) + (let ((s 0)) (--each-r-while '(1 2 3 5) (> it 1) (setq s (+ s it))) s) + ⇒ 10 -- Function: -dotimes (num fn) Call FN NUM times, presumably for side effects. FN is called with a single argument on successive integers running from 0, inclusive, - to NUM, exclusive. FN is not called if NUM is less than 1. This - function’s anaphoric counterpart is ‘--dotimes’. + to NUM, exclusive. FN is not called if NUM is less than 1. + + This function’s anaphoric counterpart is ‘--dotimes’. (let (s) (-dotimes 3 (lambda (n) (push n s))) s) - ⇒ '(2 1 0) + ⇒ (2 1 0) (let (s) (-dotimes 0 (lambda (n) (push n s))) s) - ⇒ nil + ⇒ () (let (s) (--dotimes 5 (push it s)) s) - ⇒ '(4 3 2 1 0) + ⇒ (4 3 2 1 0)  File: dash.info, Node: Destructive operations, Next: Function combinators, Prev: Side effects, Up: Functions @@ -2628,21 +2674,23 @@ File: dash.info, Node: Destructive operations, Next: Function combinators, Pr 2.15 Destructive operations =========================== +Macros that modify variables holding lists. + -- Macro: !cons (car cdr) Destructive: Set CDR to the cons of CAR and CDR. (let (l) (!cons 5 l) l) - ⇒ '(5) + ⇒ (5) (let ((l '(3))) (!cons 5 l) l) - ⇒ '(5 3) + ⇒ (5 3) -- Macro: !cdr (list) Destructive: Set LIST to the cdr of LIST. (let ((l '(3))) (!cdr l) l) - ⇒ '() + ⇒ () (let ((l '(3 5))) (!cdr l) l) - ⇒ '(5) + ⇒ (5)  File: dash.info, Node: Function combinators, Prev: Destructive operations, Up: Functions @@ -2650,64 +2698,73 @@ File: dash.info, Node: Function combinators, Prev: Destructive operations, Up 2.16 Function combinators ========================= -These combinators require Emacs 24 for its lexical scope. So they are -offered in a separate package: ‘dash-functional‘. +Functions that manipulate and compose other functions. - -- Function: -partial (fn &rest args) - Take a function FN and fewer than the normal arguments to FN, and - return a fn that takes a variable number of additional ARGS. When - called, the returned function calls FN with ARGS first and then - additional args. + -- Function: -partial (fun &rest args) + Return a function that is a partial application of FUN to ARGS. + ARGS is a list of the first N arguments to pass to FUN. The result + is a new function which does the same as FUN, except that the first + N arguments are fixed at the values with which this function was + called. - (funcall (-partial '- 5) 3) + (funcall (-partial #'+ 5)) + ⇒ 5 + (funcall (-partial #'- 5) 3) ⇒ 2 - (funcall (-partial '+ 5 2) 3) + (funcall (-partial #'+ 5 2) 3) ⇒ 10 -- Function: -rpartial (fn &rest args) - Takes a function FN and fewer than the normal arguments to FN, and - returns a fn that takes a variable number of additional ARGS. When - called, the returned function calls FN with the additional args - first and then ARGS. + Return a function that is a partial application of FN to ARGS. + ARGS is a list of the last N arguments to pass to FN. The result + is a new function which does the same as FN, except that the last N + arguments are fixed at the values with which this function was + called. This is like ‘-partial’ (*note -partial::), except the + arguments are fixed starting from the right rather than the left. - (funcall (-rpartial '- 5) 8) + (funcall (-rpartial #'- 5)) + ⇒ -5 + (funcall (-rpartial #'- 5) 8) ⇒ 3 - (funcall (-rpartial '- 5 2) 10) + (funcall (-rpartial #'- 5 2) 10) ⇒ 3 -- Function: -juxt (&rest fns) - Takes a list of functions and returns a fn that is the - juxtaposition of those fns. The returned fn takes a variable - number of args, and returns a list containing the result of - applying each fn to the args (left-to-right). + Return a function that is the juxtaposition of FNS. The returned + function takes a variable number of ARGS, applies each of FNS in + turn to ARGS, and returns the list of results. - (funcall (-juxt '+ '-) 3 5) - ⇒ '(8 -2) - (-map (-juxt 'identity 'square) '(1 2 3)) - ⇒ '((1 1) (2 4) (3 9)) + (funcall (-juxt) 1 2) + ⇒ () + (funcall (-juxt #'+ #'- #'* #'/) 7 5) + ⇒ (12 2 35 1) + (mapcar (-juxt #'number-to-string #'1+) '(1 2)) + ⇒ (("1" 2) ("2" 3)) -- Function: -compose (&rest fns) - Takes a list of functions and returns a fn that is the composition - of those fns. The returned fn takes a variable number of - arguments, and returns the result of applying each fn to the result - of applying the previous fn to the arguments (right-to-left). + Compose FNS into a single composite function. Return a function + that takes a variable number of ARGS, applies the last function in + FNS to ARGS, and returns the result of calling each remaining + function on the result of the previous function, right-to-left. If + no FNS are given, return a variadic ‘identity’ function. - (funcall (-compose 'square '+) 2 3) - ⇒ (square (+ 2 3)) - (funcall (-compose 'identity 'square) 3) - ⇒ (square 3) - (funcall (-compose 'square 'identity) 3) - ⇒ (square 3) + (funcall (-compose #'- #'1+ #'+) 1 2 3) + ⇒ -7 + (funcall (-compose #'identity #'1+) 3) + ⇒ 4 + (mapcar (-compose #'not #'stringp) '(nil "")) + ⇒ (t nil) -- Function: -applify (fn) - Changes an n-arity function FN to a 1-arity function that expects a - list with n items as arguments + Return a function that applies FN to a single list of args. This + changes the arity of FN from taking N distinct arguments to taking + 1 argument which is a list of N arguments. - (-map (-applify '+) '((1 1 1) (1 2 3) (5 5 5))) - ⇒ '(3 6 15) - (-map (-applify (lambda (a b c) `(,a (,b (,c))))) '((1 1 1) (1 2 3) (5 5 5))) - ⇒ '((1 (1 (1))) (1 (2 (3))) (5 (5 (5)))) - (funcall (-applify '<) '(3 6)) + (funcall (-applify #'+) nil) + ⇒ 0 + (mapcar (-applify #'+) '((1 1 1) (1 2 3) (5 5 5))) + ⇒ (3 6 15) + (funcall (-applify #'<) '(3 6)) ⇒ t -- Function: -on (operator transformer) @@ -2718,9 +2775,9 @@ offered in a separate package: ‘dash-functional‘. In types: (b -> b -> c) -> (a -> b) -> a -> a -> c (-sort (-on '< 'length) '((1 2 3) (1) (1 2))) - ⇒ '((1) (1 2) (1 2 3)) + ⇒ ((1) (1 2) (1 2 3)) (-min-by (-on '> 'length) '((1 2 3) (4) (1 2))) - ⇒ '(4) + ⇒ (4) (-min-by (-on 'string-lessp 'number-to-string) '(2 100 22)) ⇒ 22 @@ -2734,7 +2791,7 @@ offered in a separate package: ‘dash-functional‘. (funcall (-flip '-) 3 8) ⇒ 5 (-sort (-flip '<) '(4 3 6 1)) - ⇒ '(6 4 3 1) + ⇒ (6 4 3 1) -- Function: -const (c) Return a function that returns C ignoring any additional arguments. @@ -2744,7 +2801,7 @@ offered in a separate package: ‘dash-functional‘. (funcall (-const 2) 1 3 "foo") ⇒ 2 (-map (-const 1) '("a" "b" "c" "d")) - ⇒ '(1 1 1 1) + ⇒ (1 1 1 1) (-sum (-map (-const 1) '("a" "b" "c" "d"))) ⇒ 4 @@ -2755,11 +2812,11 @@ offered in a separate package: ‘dash-functional‘. See SRFI-26 for detailed description. (funcall (-cut list 1 <> 3 <> 5) 2 4) - ⇒ '(1 2 3 4 5) + ⇒ (1 2 3 4 5) (-map (-cut funcall <> 5) `(1+ 1- ,(lambda (x) (/ 1.0 x)))) - ⇒ '(6 4 0.2) + ⇒ (6 4 0.2) (-map (-cut <> 1 2 3) '(list vector string)) - ⇒ '((1 2 3) [1 2 3] "\^A\^B\^C") + ⇒ ((1 2 3) [1 2 3] "\1\2\3") -- Function: -not (pred) Take a unary predicate PRED and return a unary predicate that @@ -2768,7 +2825,7 @@ offered in a separate package: ‘dash-functional‘. (funcall (-not 'even?) 5) ⇒ t (-filter (-not (-partial '< 4)) '(1 2 3 4 5 6 7 8)) - ⇒ '(1 2 3 4) + ⇒ (1 2 3 4) -- Function: -orfn (&rest preds) Take list of unary predicates PREDS and return a unary predicate @@ -2778,7 +2835,7 @@ offered in a separate package: ‘dash-functional‘. In types: [a -> Bool] -> a -> Bool (-filter (-orfn 'even? (-partial (-flip '<) 5)) '(1 2 3 4 5 6 7 8 9 10)) - ⇒ '(1 2 3 4 6 8 10) + ⇒ (1 2 3 4 6 8 10) (funcall (-orfn 'stringp 'even?) "foo") ⇒ t @@ -2794,7 +2851,7 @@ offered in a separate package: ‘dash-functional‘. (funcall (-andfn (-cut < <> 10) 'even?) 12) ⇒ nil (-filter (-andfn (-not 'even?) (-cut >= 5 <>)) '(1 2 3 4 5 6 7 8 9 10)) - ⇒ '(1 3 5) + ⇒ (1 3 5) -- Function: -iteratefn (fn n) Return a function FN composed N times with itself. @@ -2817,7 +2874,7 @@ offered in a separate package: ‘dash-functional‘. (funcall (-iteratefn '1+ 3) 1) ⇒ 4 (funcall (-iteratefn 'cdr 3) '(1 2 3 4 5)) - ⇒ '(4 5) + ⇒ (4 5) -- Function: -fixfn (fn &optional equal-test halt-test) Return a function that computes the (least) fixpoint of FN. @@ -2846,12 +2903,12 @@ offered in a separate package: ‘dash-functional‘. In types: (a -> a) -> a -> a. - (funcall (-fixfn 'cos 'approx-equal) 0.7) + (funcall (-fixfn #'cos #'approx=) 0.7) ⇒ 0.7390851332151607 (funcall (-fixfn (lambda (x) (expt (+ x 10) 0.25))) 2.0) ⇒ 1.8555845286409378 - (funcall (-fixfn 'sin 'approx-equal) 0.1) - ⇒ '(halted . t) + (funcall (-fixfn #'sin #'approx=) 0.1) + ⇒ (halted . t) -- Function: -prodfn (&rest fns) Take a list of n functions and return a function that takes a list @@ -2870,9 +2927,9 @@ offered in a separate package: ‘dash-functional‘. ...)) = (-compose fn (-partial ’nth n)) (funcall (-prodfn '1+ '1- 'number-to-string) '(1 2 3)) - ⇒ '(2 1 "3") + ⇒ (2 1 "3") (-map (-prodfn '1+ '1-) '((1 2) (3 4) (5 6) (7 8))) - ⇒ '((2 1) (4 3) (6 5) (8 7)) + ⇒ ((2 1) (4 3) (6 5) (8 7)) (apply '+ (funcall (-prodfn 'length 'string-to-number) '((1 2 3) "15"))) ⇒ 18 @@ -2888,11 +2945,10 @@ The Dash repository is hosted on GitHub at * Menu: * Contribute:: How to contribute. -* Change log:: List of significant changes by version. * Contributors:: List of contributors.  -File: dash.info, Node: Contribute, Next: Change log, Up: Development +File: dash.info, Node: Contribute, Next: Contributors, Up: Development 3.1 Contribute ============== @@ -2906,7 +2962,7 @@ docs’. Contributors are encouraged to install these commands as a Git pre-commit hook, so that the tests are always running and the docs are always in sync: - $ cp pre-commit.sh .git/hooks/pre-commit + $ cp dev/pre-commit.sh .git/hooks/pre-commit Oh, and don’t edit ‘README.md’ or ‘dash.texi’ directly, as they are auto-generated. Instead, change their respective templates @@ -2917,212 +2973,9 @@ require that all contributors assign copyright to the Free Software Foundation. For more on this, *note (emacs)Copyright Assignment::.  -File: dash.info, Node: Change log, Next: Contributors, Prev: Contribute, Up: Development +File: dash.info, Node: Contributors, Prev: Contribute, Up: Development -3.2 Change log -============== - -Changes in 2.17: - - • Sped up ‘-uniq’ by using hash-tables when possible (Zhu - Zihao). - • Fixed ‘-inits’ to be non-destructive (Zach Shaftel). - • Fixed indent rules for ‘-some->’ and family (Wouter - Bolsterlee). - • Added ‘-zip-lists’ which always returns a list of proper - lists, even for two input lists (see issue #135). - -Changes in 2.16: - - • Added ‘--doto’, anaphoric version of ‘-doto’. - • Aliased ‘-cons-pair-p’ to ‘-cons-pair?’. - • Generalized ‘-rotate’ for |N| greater than the length of the - list (Brian Leung). - • Added a mechanism to extend destructuring with custom matchers - (Ivan Yonchovski). - -Changes in 2.15: - - This release brought new destructuring features, some new control - flow functions, and performance optimizations. - - • Added ‘-setq’ with destructuring binding support similar to - the ‘-let’ family. - • Added smarter key destructuring in ‘-let’ and friends where - variables are auto-derived from keys. - • Allowed ‘-let’ bindings without a source value form. - • Added ‘-each-r’ and ‘-each-r-while’ (Paul Pogonyshev). - • Added ‘-common-suffix’ (Basil L. Contovounesios). - • Improved performance of folds (‘-reduce’ and friends) (Basil - L. Contovounesios). - -Changes in 2.14: - - This release retired support for Emacs 23. - - • Added Edebug support for threading macros (Wilfred Hughes). - • Added ‘-unzip’. - • Added support for ‘-first-item’ and ‘-last-item’ as place - forms (*note (elisp)Generalized Variables::). - • Added ‘-powerset’ and ‘-permutations’ (Mark Oteiza). - • Added ‘-as->’ for threading a named variable (Zachary Kanfer). - • Added ‘-partition-after-pred’, ‘-partition-before-pred’, - ‘-partition-after-item’, and ‘-partition-before-item’ (Zachary - Kanfer). - • Fixed a bug in ‘-any-p’ and friends testing for ‘null’ on - lists containing ‘nil’. - • Fixed infinite loop bug in ‘-zip’ and ‘-interleave’ when - called with empty input. - • Added ‘-second-item’ through ‘-fifth-item’ as alternatives to - ‘nth’ (Wilfred Hughes). - • Added ‘-tails’ and ‘-inits’. - • Added ‘-running-sum’ and ‘-running-product’. - • Added the ‘-reductions[-r][-from]’ family of functions (like - ‘-reduce’ but collecting intermediate results). - • Added ‘-common-prefix’ (Basil L. Contovounesios). - -Changes in 2.13: - - • ‘-let’ now supports ‘&alist’ destructuring. - • Various performance improvements. - • ‘-zip’ might change in a future release to always return a - list of proper lists. Added ‘-zip-pair’ for users who - explicitly want the old behavior. - • Enabled lexical binding in ‘dash.el’ for Emacs versions 24 or - newer. - • Added ‘-select-column’ and ‘-select-columns’. - • Fixed ‘-map-last’ and ‘--remove-last’ to be non-destructive. - • Added ‘-each-indexed’ and ‘--each-indexed’. - • Added ‘-take-last’ and ‘-drop-last’. - • Added the ‘-doto’ macro. - • ‘-cut <>’ is now treated as a function, consistent with SRFI - 26 (https://srfi.schemers.org/srfi-26/srfi-26.html). - -Changes in 2.12: - - • Added GNU ELPA support (Phillip Lord). - • Added ‘-some->’, ‘-some->>’, and ‘-some-->’ macros (Cam Saul). - • ‘-is-suffix?’ is now non-destructive. - • Faster hash table implementation for ‘-union’. - • Improvements to docstrings and examples. - -Changes in 2.11: - - • Lots of clean up w.r.t. byte compilation, debug macros, and - tests. - -Changes in 2.10: - - • Added ‘-let’ destructuring to ‘-if-let’ and ‘-when-let’ - (Fredrik Bergroth). - -Changes in 2.9: - - • Added ‘-let’, ‘-let*’, and ‘-lambda’ with destructuring. - • Added ‘-tree-seq’ and ‘-tree-map-nodes’. - • Added ‘-non-nil’. - • Added ‘-fix’. - • Added ‘-fixfn’ (‘dash-functional’ version 1.2). - • Added ‘-copy’ (Wilfred Hughes). - -Changes in 2.8: - - • Added ‘-butlast’. - -Changes in 2.7: - - • ‘-zip’ now supports more than two lists (Steve Lamb). - • Added ‘-cycle’, ‘-pad’, ‘-annotate’, and ‘-zip-fill’ (Steve - Lamb). - • Added ‘-table’, ‘-table-flat’ (finite Cartesian product). - • Added ‘-flatten-n’. - • ‘-slice’ now supports a “step” argument. - • Added functional combinators ‘-iteratefn’ and ‘-prodfn’. - • Added ‘-replace’, ‘-splice’, and ‘-splice-list’ which - generalize ‘-replace-at’ and ‘-insert-at’. - • Added ‘-compose’, ‘-iteratefn’, and ‘-prodfn’ - (‘dash-functional’ version 1.1). - -Changes in 2.6: - - • Added ‘-is-prefix-p’, ‘-is-suffix-p’, and ‘-is-infix-p’ (Matus - Goljer). - • Added ‘-iterate’ and ‘-unfold’ (Matus Goljer). - • Added ‘-split-on’ and ‘-split-when’ (Matus Goljer). - • Added ‘-find-last-index’ (Matus Goljer). - • Added ‘-list’ (Johan Andersson). - -Changes in 2.5: - - • Added ‘-same-items?’ (Johan Andersson). - • Various bugfixes. - -Changes in 2.4: - - • Added ‘-snoc’ (Matus Goljer). - • Added ‘-replace-at’, ‘-update-at’, ‘-remove-at’, and - ‘-remove-at-indices’ (Matus Goljer). - -Changes in 2.3: - - • Added tree operations (Matus Goljer). - • Made Font Lock optional. - -Changes in 2.2: - - • Added ‘-compose’ (Christina Whyte). - -Changes in 2.1: - - • Added indexing operations (Matus Goljer). - -Changes in 2.0: - - • Split out ‘dash-functional.el’ (Matus Goljer). - • Added ‘-andfn’, ‘-orfn’, ‘-not’, ‘-cut’, ‘-const’, ‘-flip’, - and ‘-on’ (Matus Goljer). - • Fixed ‘-min’, ‘-max’, ‘-min-by’, and ‘-max-by’ (Matus Goljer). - -Changes in 1.8: - - • Added ‘-first-item’ and ‘-last-item’ (Wilfred Hughes). - -Changes in 1.7: - - • Added ‘-rotate’ (Matus Goljer). - -Changes in 1.6: - - • Added ‘-min’, ‘-max’, ‘-min-by’, and ‘-max-by’ (Johan - Andersson). - -Changes in 1.5: - - • Added ‘-sum’ and ‘-product’ (Johan Andersson). - -Changes in 1.4: - - • Added ‘-sort’. - • Added ‘-reduce-r’ (Matus Goljer). - • Added ‘-reduce-r-from’ (Matus Goljer). - -Changes in 1.3: - - • Added ‘-partition-in-steps’. - • Added ‘-partition-all-in-steps’. - -Changes in 1.2: - - • Added ‘-last’ (Matus Goljer). - • Added ‘-insert-at’ (Emanuel Evans). - • Added ‘-when-let’ and ‘-if-let’ (Emanuel Evans). - • Added ‘-when-let*’ and ‘-if-let*’ (Emanuel Evans). - • Various bugfixes. - - -File: dash.info, Node: Contributors, Prev: Change log, Up: Development - -3.3 Contributors +3.2 Contributors ================ • Matus Goljer (https://github.com/Fuco1) contributed lots of @@ -3145,8 +2998,8 @@ File: dash.info, Node: Contributors, Prev: Change log, Up: Development • Fredrik Bergroth (https://github.com/fbergroth) made the ‘-if-let’ family use ‘-let’ destructuring and improved the script for generating documentation. - • Mark Oteiza (https://github.com/holomorph) contributed the script - to create an Info manual. + • Mark Oteiza (https://github.com/holomorph) contributed ‘-iota’ and + the script to create an Info manual. • Vasilij Schneidermann (https://github.com/wasamasa) contributed ‘-some’. • William West (https://github.com/occidens) made ‘-fixfn’ more @@ -3154,7 +3007,8 @@ File: dash.info, Node: Contributors, Prev: Change log, Up: Development • Cam Saul (https://github.com/camsaul) contributed ‘-some->’, ‘-some->>’, and ‘-some-->’. • Basil L. Contovounesios (https://github.com/basil-conto) - contributed ‘-common-prefix’. + contributed ‘-common-prefix’, ‘-common-suffix’, and various other + improvements. • Paul Pogonyshev (https://github.com/doublep) contributed ‘-each-r’ and ‘-each-r-while’. @@ -4370,52 +4224,52 @@ Index * Menu: * !cdr: Destructive operations. - (line 14) + (line 16) * !cons: Destructive operations. - (line 6) -* -->: Threading macros. (line 32) -* ->: Threading macros. (line 6) -* ->>: Threading macros. (line 19) -* -all?: Predicates. (line 18) + (line 8) +* -->: Threading macros. (line 35) +* ->: Threading macros. (line 9) +* ->>: Threading macros. (line 22) +* -all?: Predicates. (line 20) * -andfn: Function combinators. - (line 138) -* -annotate: Maps. (line 79) -* -any?: Predicates. (line 6) + (line 147) +* -annotate: Maps. (line 84) +* -any?: Predicates. (line 8) * -applify: Function combinators. - (line 55) -* -as->: Threading macros. (line 46) + (line 63) +* -as->: Threading macros. (line 49) * -butlast: Other list operations. (line 350) * -clone: Tree operations. (line 122) -* -common-prefix: Reductions. (line 227) -* -common-suffix: Reductions. (line 237) +* -common-prefix: Reductions. (line 242) +* -common-suffix: Reductions. (line 252) * -compose: Function combinators. - (line 42) -* -concat: List to list. (line 22) + (line 49) +* -concat: List to list. (line 23) * -cons*: Other list operations. (line 30) -* -cons-pair?: Predicates. (line 124) +* -cons-pair?: Predicates. (line 126) * -const: Function combinators. - (line 92) -* -contains?: Predicates. (line 57) -* -copy: Maps. (line 134) -* -count: Reductions. (line 157) + (line 101) +* -contains?: Predicates. (line 59) +* -copy: Maps. (line 139) +* -count: Reductions. (line 172) * -cut: Function combinators. - (line 104) + (line 113) * -cycle: Other list operations. (line 180) * -difference: Set operations. (line 20) * -distinct: Set operations. (line 62) -* -dotimes: Side effects. (line 72) -* -doto: Threading macros. (line 95) -* -drop: Sublist selection. (line 127) -* -drop-last: Sublist selection. (line 142) -* -drop-while: Sublist selection. (line 170) +* -dotimes: Side effects. (line 80) +* -doto: Threading macros. (line 99) +* -drop: Sublist selection. (line 147) +* -drop-last: Sublist selection. (line 161) +* -drop-while: Sublist selection. (line 192) * -each: Side effects. (line 8) -* -each-indexed: Side effects. (line 34) -* -each-r: Side effects. (line 47) -* -each-r-while: Side effects. (line 59) -* -each-while: Side effects. (line 21) +* -each-indexed: Side effects. (line 38) +* -each-r: Side effects. (line 52) +* -each-r-while: Side effects. (line 65) +* -each-while: Side effects. (line 24) * -elem-index: Indexing. (line 9) * -elem-indices: Indexing. (line 21) * -fifth-item: Other list operations. @@ -4427,24 +4281,24 @@ Index * -first: Other list operations. (line 246) * -first-item: Other list operations. - (line 281) + (line 287) * -fix: Other list operations. (line 390) * -fixfn: Function combinators. - (line 175) -* -flatten: List to list. (line 33) -* -flatten-n: List to list. (line 55) + (line 184) +* -flatten: List to list. (line 34) +* -flatten-n: List to list. (line 56) * -flip: Function combinators. - (line 80) + (line 89) * -fourth-item: Other list operations. (line 320) * -grade-down: Indexing. (line 81) * -grade-up: Indexing. (line 71) * -group-by: Partitioning. (line 193) -* -if-let: Binding. (line 36) -* -if-let*: Binding. (line 49) -* -inits: Reductions. (line 207) -* -insert-at: List to list. (line 109) +* -if-let: Binding. (line 34) +* -if-let*: Binding. (line 45) +* -inits: Reductions. (line 222) +* -insert-at: List to list. (line 110) * -interleave: Other list operations. (line 67) * -interpose: Other list operations. @@ -4452,47 +4306,47 @@ Index * -intersection: Set operations. (line 32) * -iota: Other list operations. (line 78) -* -is-infix?: Predicates. (line 110) -* -is-prefix?: Predicates. (line 86) -* -is-suffix?: Predicates. (line 98) +* -is-infix?: Predicates. (line 112) +* -is-prefix?: Predicates. (line 88) +* -is-suffix?: Predicates. (line 100) * -iterate: Unfolding. (line 9) * -iteratefn: Function combinators. - (line 152) + (line 161) * -juxt: Function combinators. - (line 31) + (line 37) * -keep: List to list. (line 8) -* -lambda: Binding. (line 251) +* -lambda: Binding. (line 247) * -last: Other list operations. - (line 271) + (line 277) * -last-item: Other list operations. (line 340) -* -let: Binding. (line 65) -* -let*: Binding. (line 231) +* -let: Binding. (line 61) +* -let*: Binding. (line 227) * -list: Other list operations. (line 373) * -map: Maps. (line 10) -* -map-first: Maps. (line 37) -* -map-indexed: Maps. (line 65) -* -map-last: Maps. (line 51) -* -map-when: Maps. (line 21) -* -mapcat: Maps. (line 123) -* -max: Reductions. (line 271) -* -max-by: Reductions. (line 281) -* -min: Reductions. (line 247) -* -min-by: Reductions. (line 257) -* -non-nil: Sublist selection. (line 78) -* -none?: Predicates. (line 30) +* -map-first: Maps. (line 38) +* -map-indexed: Maps. (line 66) +* -map-last: Maps. (line 52) +* -map-when: Maps. (line 22) +* -mapcat: Maps. (line 128) +* -max: Reductions. (line 286) +* -max-by: Reductions. (line 296) +* -min: Reductions. (line 262) +* -min-by: Reductions. (line 272) +* -non-nil: Sublist selection. (line 94) +* -none?: Predicates. (line 32) * -not: Function combinators. - (line 117) -* -on: Function combinators. - (line 66) -* -only-some?: Predicates. (line 42) -* -orfn: Function combinators. (line 126) +* -on: Function combinators. + (line 75) +* -only-some?: Predicates. (line 44) +* -orfn: Function combinators. + (line 135) * -pad: Other list operations. (line 191) * -partial: Function combinators. - (line 9) + (line 8) * -partition: Partitioning. (line 80) * -partition-after-item: Partitioning. (line 183) * -partition-after-pred: Partitioning. (line 151) @@ -4506,69 +4360,69 @@ Index * -permutations: Set operations. (line 52) * -powerset: Set operations. (line 44) * -prodfn: Function combinators. - (line 209) -* -product: Reductions. (line 186) -* -reduce: Reductions. (line 51) + (line 218) +* -product: Reductions. (line 201) +* -reduce: Reductions. (line 53) * -reduce-from: Reductions. (line 8) -* -reduce-r: Reductions. (line 69) -* -reduce-r-from: Reductions. (line 25) -* -reductions: Reductions. (line 126) -* -reductions-from: Reductions. (line 96) -* -reductions-r: Reductions. (line 141) -* -reductions-r-from: Reductions. (line 111) -* -remove: Sublist selection. (line 21) -* -remove-at: List to list. (line 145) -* -remove-at-indices: List to list. (line 158) -* -remove-first: Sublist selection. (line 34) -* -remove-item: Sublist selection. (line 66) -* -remove-last: Sublist selection. (line 51) +* -reduce-r: Reductions. (line 72) +* -reduce-r-from: Reductions. (line 26) +* -reductions: Reductions. (line 136) +* -reductions-from: Reductions. (line 100) +* -reductions-r: Reductions. (line 154) +* -reductions-r-from: Reductions. (line 118) +* -remove: Sublist selection. (line 26) +* -remove-at: List to list. (line 146) +* -remove-at-indices: List to list. (line 159) +* -remove-first: Sublist selection. (line 43) +* -remove-item: Sublist selection. (line 83) +* -remove-last: Sublist selection. (line 64) * -repeat: Other list operations. (line 19) -* -replace: List to list. (line 67) -* -replace-at: List to list. (line 120) -* -replace-first: List to list. (line 81) -* -replace-last: List to list. (line 95) +* -replace: List to list. (line 68) +* -replace-at: List to list. (line 121) +* -replace-first: List to list. (line 82) +* -replace-last: List to list. (line 96) * -rotate: Other list operations. (line 8) * -rpartial: Function combinators. - (line 20) -* -running-product: Reductions. (line 196) -* -running-sum: Reductions. (line 175) -* -same-items?: Predicates. (line 72) + (line 22) +* -running-product: Reductions. (line 211) +* -running-sum: Reductions. (line 190) +* -same-items?: Predicates. (line 74) * -second-item: Other list operations. - (line 296) -* -select-by-indices: Sublist selection. (line 184) -* -select-column: Sublist selection. (line 214) -* -select-columns: Sublist selection. (line 195) + (line 300) +* -select-by-indices: Sublist selection. (line 208) +* -select-column: Sublist selection. (line 238) +* -select-columns: Sublist selection. (line 219) * -separate: Partitioning. (line 69) -* -setq: Binding. (line 274) -* -slice: Sublist selection. (line 84) +* -setq: Binding. (line 270) +* -slice: Sublist selection. (line 104) * -snoc: Other list operations. (line 43) * -some: Other list operations. - (line 259) -* -some-->: Threading macros. (line 83) -* -some->: Threading macros. (line 59) -* -some->>: Threading macros. (line 71) + (line 262) +* -some-->: Threading macros. (line 86) +* -some->: Threading macros. (line 62) +* -some->>: Threading macros. (line 74) * -sort: Other list operations. (line 360) -* -splice: Maps. (line 90) -* -splice-list: Maps. (line 110) +* -splice: Maps. (line 95) +* -splice-list: Maps. (line 115) * -split-at: Partitioning. (line 8) * -split-on: Partitioning. (line 34) * -split-when: Partitioning. (line 52) * -split-with: Partitioning. (line 23) -* -sum: Reductions. (line 165) +* -sum: Reductions. (line 180) * -table: Other list operations. (line 202) * -table-flat: Other list operations. (line 221) -* -tails: Reductions. (line 217) -* -take: Sublist selection. (line 100) -* -take-last: Sublist selection. (line 113) -* -take-while: Sublist selection. (line 156) +* -tails: Reductions. (line 232) +* -take: Sublist selection. (line 120) +* -take-last: Sublist selection. (line 133) +* -take-while: Sublist selection. (line 175) * -third-item: Other list operations. - (line 308) + (line 310) * -tree-map: Tree operations. (line 28) * -tree-map-nodes: Tree operations. (line 39) * -tree-mapreduce: Tree operations. (line 84) @@ -4580,9 +4434,9 @@ Index * -union: Set operations. (line 8) * -unzip: Other list operations. (line 158) -* -update-at: List to list. (line 132) +* -update-at: List to list. (line 133) * -when-let: Binding. (line 9) -* -when-let*: Binding. (line 23) +* -when-let*: Binding. (line 21) * -zip: Other list operations. (line 107) * -zip-fill: Other list operations. @@ -4601,210 +4455,209 @@ Index  Tag Table: Node: Top742 -Node: Installation2461 -Node: Using in a package3290 -Node: Fontification of special variables3790 -Node: Info symbol lookup4580 -Node: Functions5163 -Node: Maps6647 -Ref: -map6944 -Ref: -map-when7320 -Ref: -map-first7898 -Ref: -map-last8376 -Ref: -map-indexed8849 -Ref: -annotate9329 -Ref: -splice9819 -Ref: -splice-list10600 -Ref: -mapcat11062 -Ref: -copy11438 -Node: Sublist selection11642 -Ref: -filter11835 -Ref: -remove12372 -Ref: -remove-first12904 -Ref: -remove-last13744 -Ref: -remove-item14265 -Ref: -non-nil14660 -Ref: -slice14819 -Ref: -take15351 -Ref: -take-last15761 -Ref: -drop16195 -Ref: -drop-last16657 -Ref: -take-while17086 -Ref: -drop-while17698 -Ref: -select-by-indices18316 -Ref: -select-columns18830 -Ref: -select-column19536 -Node: List to list20000 -Ref: -keep20192 -Ref: -concat20695 -Ref: -flatten20992 -Ref: -flatten-n21751 -Ref: -replace22138 -Ref: -replace-first22601 -Ref: -replace-last23098 -Ref: -insert-at23588 -Ref: -replace-at23915 -Ref: -update-at24305 -Ref: -remove-at24796 -Ref: -remove-at-indices25284 -Node: Reductions25866 -Ref: -reduce-from26062 -Ref: -reduce-r-from26787 -Ref: -reduce28051 -Ref: -reduce-r28803 -Ref: -reductions-from30082 -Ref: -reductions-r-from30886 -Ref: -reductions31714 -Ref: -reductions-r32423 -Ref: -count33171 -Ref: -sum33395 -Ref: -running-sum33584 -Ref: -product33910 -Ref: -running-product34119 -Ref: -inits34465 -Ref: -tails34713 -Ref: -common-prefix34960 -Ref: -common-suffix35257 -Ref: -min35554 -Ref: -min-by35780 -Ref: -max36303 -Ref: -max-by36528 -Node: Unfolding37056 -Ref: -iterate37297 -Ref: -unfold37747 -Node: Predicates38555 -Ref: -any?38679 -Ref: -all?38999 -Ref: -none?39329 -Ref: -only-some?39631 -Ref: -contains?40116 -Ref: -same-items?40505 -Ref: -is-prefix?40890 -Ref: -is-suffix?41213 -Ref: -is-infix?41536 -Ref: -cons-pair?41890 -Node: Partitioning42210 -Ref: -split-at42398 -Ref: -split-with43065 -Ref: -split-on43468 -Ref: -split-when44144 -Ref: -separate44784 -Ref: -partition45226 -Ref: -partition-all45678 -Ref: -partition-in-steps46106 -Ref: -partition-all-in-steps46603 -Ref: -partition-by47088 -Ref: -partition-by-header47470 -Ref: -partition-after-pred48074 -Ref: -partition-before-pred48418 -Ref: -partition-before-item48769 -Ref: -partition-after-item49080 -Ref: -group-by49386 -Node: Indexing49823 -Ref: -elem-index50025 -Ref: -elem-indices50420 -Ref: -find-index50803 -Ref: -find-last-index51292 -Ref: -find-indices51796 -Ref: -grade-up52204 -Ref: -grade-down52613 -Node: Set operations53029 -Ref: -union53212 -Ref: -difference53654 -Ref: -intersection54071 -Ref: -powerset54508 -Ref: -permutations54721 -Ref: -distinct55021 -Node: Other list operations55399 -Ref: -rotate55624 -Ref: -repeat55994 -Ref: -cons*56275 -Ref: -snoc56693 -Ref: -interpose57106 -Ref: -interleave57404 -Ref: -iota57773 -Ref: -zip-with58260 -Ref: -zip58977 -Ref: -zip-lists59809 -Ref: -zip-fill60510 -Ref: -unzip60833 -Ref: -cycle61578 -Ref: -pad61980 -Ref: -table62303 -Ref: -table-flat63092 -Ref: -first64100 -Ref: -some64581 -Ref: -last65061 -Ref: -first-item65395 -Ref: -second-item65811 -Ref: -third-item66091 -Ref: -fourth-item66369 -Ref: -fifth-item66635 -Ref: -last-item66897 -Ref: -butlast67189 -Ref: -sort67436 -Ref: -list67925 -Ref: -fix68519 -Node: Tree operations69010 -Ref: -tree-seq69206 -Ref: -tree-map70064 -Ref: -tree-map-nodes70507 -Ref: -tree-reduce71357 -Ref: -tree-reduce-from72239 -Ref: -tree-mapreduce72840 -Ref: -tree-mapreduce-from73700 -Ref: -clone74986 -Node: Threading macros75314 -Ref: ->75459 -Ref: ->>75950 -Ref: -->76455 -Ref: -as->77011 -Ref: -some->77466 -Ref: -some->>77840 -Ref: -some-->78276 -Ref: -doto78747 -Node: Binding79303 -Ref: -when-let79515 -Ref: -when-let*80000 -Ref: -if-let80523 -Ref: -if-let*80918 -Ref: -let81535 -Ref: -let*87610 -Ref: -lambda88550 -Ref: -setq89359 -Node: Side effects90183 -Ref: -each90377 -Ref: -each-while90894 -Ref: -each-indexed91498 -Ref: -each-r92088 -Ref: -each-r-while92526 -Ref: -dotimes93149 -Node: Destructive operations93705 -Ref: !cons93878 -Ref: !cdr94084 -Node: Function combinators94279 -Ref: -partial94553 -Ref: -rpartial94947 -Ref: -juxt95350 -Ref: -compose95782 -Ref: -applify96335 -Ref: -on96766 -Ref: -flip97292 -Ref: -const97604 -Ref: -cut97943 -Ref: -not98429 -Ref: -orfn98739 -Ref: -andfn99173 -Ref: -iteratefn99668 -Ref: -fixfn100371 -Ref: -prodfn101934 -Node: Development102994 -Node: Contribute103347 -Node: Change log104353 -Node: Contributors111891 -Node: FDL113909 -Node: GPL139229 -Node: Index176978 +Node: Installation2397 +Node: Using in a package3159 +Node: Fontification of special variables3504 +Node: Info symbol lookup4294 +Node: Functions4877 +Node: Maps6361 +Ref: -map6658 +Ref: -map-when7031 +Ref: -map-first7606 +Ref: -map-last8081 +Ref: -map-indexed8551 +Ref: -annotate9237 +Ref: -splice9724 +Ref: -splice-list10502 +Ref: -mapcat10961 +Ref: -copy11334 +Node: Sublist selection11522 +Ref: -filter11715 +Ref: -remove12262 +Ref: -remove-first12800 +Ref: -remove-last13642 +Ref: -remove-item14367 +Ref: -non-nil14767 +Ref: -slice15043 +Ref: -take15572 +Ref: -take-last15979 +Ref: -drop16410 +Ref: -drop-last16851 +Ref: -take-while17277 +Ref: -drop-while17892 +Ref: -select-by-indices18508 +Ref: -select-columns19019 +Ref: -select-column19722 +Node: List to list20185 +Ref: -keep20377 +Ref: -concat20941 +Ref: -flatten21235 +Ref: -flatten-n21991 +Ref: -replace22375 +Ref: -replace-first22836 +Ref: -replace-last23331 +Ref: -insert-at23819 +Ref: -replace-at24144 +Ref: -update-at24531 +Ref: -remove-at25019 +Ref: -remove-at-indices25504 +Node: Reductions26083 +Ref: -reduce-from26279 +Ref: -reduce-r-from27003 +Ref: -reduce28266 +Ref: -reduce-r29017 +Ref: -reductions-from30295 +Ref: -reductions-r-from31101 +Ref: -reductions31931 +Ref: -reductions-r32642 +Ref: -count33387 +Ref: -sum33611 +Ref: -running-sum33799 +Ref: -product34120 +Ref: -running-product34328 +Ref: -inits34669 +Ref: -tails34914 +Ref: -common-prefix35158 +Ref: -common-suffix35452 +Ref: -min35746 +Ref: -min-by35972 +Ref: -max36493 +Ref: -max-by36718 +Node: Unfolding37244 +Ref: -iterate37485 +Ref: -unfold37932 +Node: Predicates38737 +Ref: -any?38914 +Ref: -all?39234 +Ref: -none?39564 +Ref: -only-some?39866 +Ref: -contains?40351 +Ref: -same-items?40740 +Ref: -is-prefix?41125 +Ref: -is-suffix?41451 +Ref: -is-infix?41777 +Ref: -cons-pair?42131 +Node: Partitioning42456 +Ref: -split-at42644 +Ref: -split-with43308 +Ref: -split-on43708 +Ref: -split-when44381 +Ref: -separate45018 +Ref: -partition45457 +Ref: -partition-all45906 +Ref: -partition-in-steps46331 +Ref: -partition-all-in-steps46825 +Ref: -partition-by47307 +Ref: -partition-by-header47685 +Ref: -partition-after-pred48286 +Ref: -partition-before-pred48664 +Ref: -partition-before-item49049 +Ref: -partition-after-item49356 +Ref: -group-by49658 +Node: Indexing50091 +Ref: -elem-index50293 +Ref: -elem-indices50688 +Ref: -find-index51068 +Ref: -find-last-index51557 +Ref: -find-indices52061 +Ref: -grade-up52466 +Ref: -grade-down52873 +Node: Set operations53287 +Ref: -union53470 +Ref: -difference53908 +Ref: -intersection54320 +Ref: -powerset54752 +Ref: -permutations54962 +Ref: -distinct55258 +Node: Other list operations55632 +Ref: -rotate55857 +Ref: -repeat56224 +Ref: -cons*56503 +Ref: -snoc56919 +Ref: -interpose57329 +Ref: -interleave57623 +Ref: -iota57989 +Ref: -zip-with58472 +Ref: -zip59186 +Ref: -zip-lists60015 +Ref: -zip-fill60713 +Ref: -unzip61035 +Ref: -cycle61777 +Ref: -pad62176 +Ref: -table62495 +Ref: -table-flat63281 +Ref: -first64286 +Ref: -some64772 +Ref: -last65256 +Ref: -first-item65590 +Ref: -second-item65989 +Ref: -third-item66253 +Ref: -fourth-item66515 +Ref: -fifth-item66781 +Ref: -last-item67043 +Ref: -butlast67334 +Ref: -sort67579 +Ref: -list68065 +Ref: -fix68634 +Node: Tree operations69123 +Ref: -tree-seq69319 +Ref: -tree-map70174 +Ref: -tree-map-nodes70614 +Ref: -tree-reduce71461 +Ref: -tree-reduce-from72343 +Ref: -tree-mapreduce72943 +Ref: -tree-mapreduce-from73802 +Ref: -clone75087 +Node: Threading macros75414 +Ref: ->75639 +Ref: ->>76127 +Ref: -->76630 +Ref: -as->77186 +Ref: -some->77640 +Ref: -some->>78013 +Ref: -some-->78448 +Ref: -doto78997 +Node: Binding79550 +Ref: -when-let79757 +Ref: -when-let*80212 +Ref: -if-let80735 +Ref: -if-let*81095 +Ref: -let81712 +Ref: -let*87784 +Ref: -lambda88721 +Ref: -setq89527 +Node: Side effects90328 +Ref: -each90522 +Ref: -each-while91043 +Ref: -each-indexed91645 +Ref: -each-r92231 +Ref: -each-r-while92667 +Ref: -dotimes93293 +Node: Destructive operations93846 +Ref: !cons94064 +Ref: !cdr94268 +Node: Function combinators94461 +Ref: -partial94665 +Ref: -rpartial95183 +Ref: -juxt95831 +Ref: -compose96283 +Ref: -applify96890 +Ref: -on97320 +Ref: -flip97844 +Ref: -const98155 +Ref: -cut98493 +Ref: -not98973 +Ref: -orfn99282 +Ref: -andfn99715 +Ref: -iteratefn100209 +Ref: -fixfn100911 +Ref: -prodfn102467 +Node: Development103525 +Node: Contribute103814 +Node: Contributors104826 +Node: FDL106919 +Node: GPL132239 +Node: Index169988  End Tag Table diff --git a/elpa/dash-20210116.1426/dir b/elpa/dash-20210330.1544/dir similarity index 100% rename from elpa/dash-20210116.1426/dir rename to elpa/dash-20210330.1544/dir