Skip to content

Instantly share code, notes, and snippets.

@eraserhd
Created September 13, 2019 13:30
Show Gist options
  • Save eraserhd/4152a8774064e97643e931882676f4b6 to your computer and use it in GitHub Desktop.
Save eraserhd/4152a8774064e97643e931882676f4b6 to your computer and use it in GitHub Desktop.
m/search
(defn last-sent-input-tx [eav-map]
(m/search eav-map
{?lsi {:last-sent-task-input/input [?input]
:last-sent-task-input/exec-uuid [?exec-uuid]}
?exec {:taskexec/uuid [?exec-uuid]
:taskexec/def [?def]}
?def {:taskdef/automated [false]}}
[:db/add ?lsi :last-sent-task-input/input (fix-input ?input)]))
@noprompt
Copy link

Here's the macroexpansion of that pattern match with epsilon.

(let* [target__13764 eav-map]
  (if (map? target__13764)
    (let* [x__13765 (set target__13764)]
      (if (<= 3 (count x__13765))
        (mapcat
         (fn*
          ([perm__13766]
           (let* [nth_0__13767 (nth perm__13766 0)
                  nth_1__13768 (nth perm__13766 1)
                  nth_2__13769 (nth perm__13766 2)]
             (let* [nth_0__13770 (nth nth_0__13767 0)
                    nth_1__13771 (nth nth_0__13767 1)]
               (let* [?lsi nth_0__13770]
                 (if (map? nth_1__13771)
                   (let* [val__13772 (get nth_1__13771 :last-sent-task-input/input)]
                     (if (vector? val__13772)
                       (if (= (count val__13772) 1)
                         (let* [nth_0__13800 (nth val__13772 0)]
                           (let* [?input nth_0__13800]
                             (let* [val__13773 (get nth_1__13771 :last-sent-task-input/exec-uuid)]
                               (if (vector? val__13773)
                                 (if (= (count val__13773) 1)
                                   (let* [nth_0__13795 (nth val__13773 0)]
                                     (let* [?exec-uuid nth_0__13795]
                                       (let* [nth_0__13774 (nth nth_1__13768 0)
                                              nth_1__13775 (nth nth_1__13768 1)]
                                         (let* [?exec nth_0__13774]
                                           (if (map? nth_1__13775)
                                             (let* [val__13776 (get nth_1__13775 :taskexec/uuid)]
                                               (if (vector? val__13776)
                                                 (if (= (count val__13776) 1)
                                                   (let* [nth_0__13790 (nth val__13776 0)]
                                                     (if (= ?exec-uuid nth_0__13790)
                                                       (let* [val__13777 (get nth_1__13775 :taskexec/def)]
                                                         (if (vector? val__13777)
                                                           (if (= (count val__13777) 1)
                                                             (let* [nth_0__13785 (nth val__13777 0)]
                                                               (let* [?def nth_0__13785]
                                                                 (let* [nth_0__13778 (nth nth_2__13769 0)
                                                                        nth_1__13779 (nth nth_2__13769 1)]
                                                                   (if (= ?def nth_0__13778)
                                                                     (if (map? nth_1__13779)
                                                                       (let* [val__13780 (get nth_1__13779 :taskdef/automated)]
                                                                         (let* [G__13801 val__13780]
                                                                           (case* G__13801 0 0 nil {1268 [[false] (list [:db/add ?lsi :last-sent-task-input/input (fix-input ?input)])]} :compact :hash-equiv nil)))
                                                                       nil)
                                                                     nil))))
                                                             nil)
                                                           nil))
                                                       nil))
                                                   nil)
                                                 nil))
                                             nil)))))
                                   nil)
                                 nil))))
                         nil)
                       nil))
                   nil))))))
          (meander.match.runtime.epsilon/k-combinations x__13765 3))
        nil))
    nil))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment