From 12cd3a361f105cd1595933efbae633aef4d71893 Mon Sep 17 00:00:00 2001 From: Simon Brooke Date: Wed, 3 Oct 2018 12:58:47 +0100 Subject: [PATCH] Added `entity-by-name` --- src/adl_support/utils.clj | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/adl_support/utils.clj b/src/adl_support/utils.clj index 2d1b8d2..8f8ac6b 100644 --- a/src/adl_support/utils.clj +++ b/src/adl_support/utils.clj @@ -672,3 +672,14 @@ (empty? rhs) (reverse lhs) (some #(= (first rhs) %) lhs) (recur lhs (rest rhs)) true (recur (cons (first rhs) lhs) (rest rhs))))) + + +(defmacro entity-by-name + "Return the entity with this `entity-name` in this `application`. + TODO: Candidate for move to adl-support.utils." + [entity-name application] + `(child-with-tag + ~application + :entity + #(= (:name (:attrs %)) ~entity-name))) +