Function: -doto

-doto is a macro defined in dash.el.

Signature

(-doto INIT &rest FORMS)

Documentation

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.

Source Code

;; Defined in ~/.emacs.d/elpa/dash-20260221.1346/dash.el
(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 &rest &or symbolp consp)) (indent 1))
  (let ((retval (make-symbol "result")))
    `(let ((,retval ,init))
       ,@(mapcar (lambda (form) `(-> ,retval ,form)) forms)
       ,retval)))