From 587959d1ff94afa80582d22ac0dbb048bb24ac34 Mon Sep 17 00:00:00 2001 From: Richard Newman Date: Wed, 10 Aug 2016 13:15:58 -0700 Subject: [PATCH] Simplify id-literal?, avoid some consing. --- src/datomish/db.cljc | 2 +- src/datomish/transact.cljc | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/datomish/db.cljc b/src/datomish/db.cljc index 43f191db..9df617cf 100644 --- a/src/datomish/db.cljc +++ b/src/datomish/db.cljc @@ -58,7 +58,7 @@ (->TempId part idx))) (defn id-literal? [x] - (and (instance? TempId x))) + (instance? TempId x)) (defprotocol IClock (now diff --git a/src/datomish/transact.cljc b/src/datomish/transact.cljc index 2e69918b..694aa2d8 100644 --- a/src/datomish/transact.cljc +++ b/src/datomish/transact.cljc @@ -284,7 +284,9 @@ report (and (not= op :db/add) - (not (empty? (filter id-literal? [e a v])))) + (or (id-literal? e) + (id-literal? a) + (id-literal? v))) (raise "id-literals are resolved for :db/add only" {:error :transact/syntax :op entity })