branch: externals/dash commit b4faa9397e06206b646f684a603e320f962674d1 Merge: 0468a31 d7b769b Author: Matus Goljer <dota.k...@gmail.com> Commit: GitHub <nore...@github.com>
Merge pull request #224 from Wilfred/when-let-docstring Docstring improvements --- dash.el | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/dash.el b/dash.el index 4a33706..9965953 100644 --- a/dash.el +++ b/dash.el @@ -97,7 +97,7 @@ the target form." (defun -each-indexed (list fn) "Call (FN index item) for each item in LIST. -In the anaphoric form `--each-indexed', the index is exposed as `it-index`. +In the anaphoric form `--each-indexed', the index is exposed as symbol `it-index'. See also: `-map-indexed'." (--each list (funcall fn it-index it))) @@ -126,7 +126,7 @@ Return nil, used for side-effects only." (put '-each-while 'lisp-indent-function 2) (defmacro --dotimes (num &rest body) - "Repeatedly executes BODY (presumably for side-effects) with `it` bound to integers from 0 through NUM-1." + "Repeatedly executes BODY (presumably for side-effects) with symbol `it' bound to integers from 0 through NUM-1." (declare (debug (form body)) (indent 1)) (let ((n (make-symbol "num"))) @@ -165,7 +165,7 @@ item, etc. If LIST contains no items, return INITIAL-VALUE and FN is not called. In the anaphoric form `--reduce-from', the accumulated value is -exposed as `acc`. +exposed as symbol `acc'. See also: `-reduce', `-reduce-r'" (--reduce-from (funcall fn acc it) initial-value list)) @@ -187,7 +187,7 @@ reduce return the result of calling FN with no arguments. If LIST has only 1 item, it is returned and FN is not called. In the anaphoric form `--reduce', the accumulated value is -exposed as `acc`. +exposed as symbol `acc'. See also: `-reduce-from', `-reduce-r'" (if list @@ -345,7 +345,7 @@ If you want to select the original items satisfying a predicate use `-filter'." (defun -map-indexed (fn list) "Return a new list consisting of the result of (FN index item) for each item in LIST. -In the anaphoric form `--map-indexed', the index is exposed as `it-index`. +In the anaphoric form `--map-indexed', the index is exposed as symbol `it-index'. See also: `-each-indexed'." (--map-indexed (funcall fn it-index it) list)) @@ -1083,7 +1083,7 @@ elements of LIST. Keys are compared by `equal'." (defmacro --zip-with (form list1 list2) "Anaphoric form of `-zip-with'. -The elements in list1 is bound as `it`, the elements in list2 as `other`." +The elements in list1 are bound as symbol `it', the elements in list2 as symbol `other'." (declare (debug (form form form))) (let ((r (make-symbol "result")) (l1 (make-symbol "list1")) @@ -1105,8 +1105,8 @@ function is applied pairwise taking as first argument element of LIST1 and as second argument element of LIST2 at corresponding position. -The anaphoric form `--zip-with' binds the elements from LIST1 as `it`, -and the elements from LIST2 as `other`." +The anaphoric form `--zip-with' binds the elements from LIST1 as symbol `it', +and the elements from LIST2 as symbol `other'." (--zip-with (funcall fn it other) list1 list2)) (defun -zip (&rest lists) @@ -1357,7 +1357,7 @@ last item in second form, etc." (defmacro --> (x &rest forms) "Starting with the value of X, thread each expression through FORMS. -Insert X at the position signified by the token `it' in the first +Insert X at the position signified by the symbol `it' in the first form. If there are more forms, insert the first form at the position signified by `it' in in second form, etc." (declare (debug (form body))) @@ -1897,15 +1897,17 @@ encountered." (defmacro -if-let (var-val then &rest else) "If VAL evaluates to non-nil, bind it to VAR and do THEN, -otherwise do ELSE. VAR-VAL should be a (VAR VAL) pair. +otherwise do ELSE. -Note: binding is done according to `-let'." +Note: binding is done according to `-let'. + +\(fn (VAR VAL) THEN &rest ELSE)" (declare (debug ((sexp form) form body)) (indent 2)) `(-if-let* (,var-val) ,then ,@else)) (defmacro --if-let (val then &rest else) - "If VAL evaluates to non-nil, bind it to `it' and do THEN, + "If VAL evaluates to non-nil, bind it to symbol `it' and do THEN, otherwise do ELSE." (declare (debug (form form body)) (indent 2)) @@ -1925,16 +1927,17 @@ encountered." (defmacro -when-let (var-val &rest body) "If VAL evaluates to non-nil, bind it to VAR and execute body. -VAR-VAL should be a (VAR VAL) pair. -Note: binding is done according to `-let'." +Note: binding is done according to `-let'. + +\(fn (VAR VAL) &rest BODY)" (declare (debug ((sexp form) body)) (indent 1)) `(-if-let ,var-val (progn ,@body))) (defmacro --when-let (val &rest body) - "If VAL evaluates to non-nil, bind it to `it' and execute -body." + "If VAL evaluates to non-nil, bind it to symbol `it' and +execute body." (declare (debug (form body)) (indent 1)) `(--if-let ,val (progn ,@body)))