Created
January 6, 2014 22:10
-
-
Save bitemyapp/8290710 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import edn | |
inc_id_gen = """ | |
[{:db/id #db/id [:db.part/user] | |
:db/ident :auto-id-generator | |
:db/fn #db/fn {:lang "clojure" | |
:params [db e attr prefix] | |
:code "(let [key (keyword (str \\"increment/\\" prefix)) | |
counter (first (datomic.api/q '[:find ?e ?val :in $ ?key :where [?e ?key ?val]] db key)) | |
c-entity (first counter) | |
c-val (inc (second counter))] | |
[[:db/add (first counter) key c-val] | |
[:db/add e attr (str prefix c-val)]])"}}] | |
""" | |
ipdb> edn.loads(inc_id_gen) | |
*** ValueError: Could not coerce frozendict({term('Keyword(Symbol("lang"))'): u'clojure', term('Keyword(Symbol("code"))'): u'(let [key (keyword (str "increment/" prefix))\n counter (first (datomic.api/q \'[:find ?e ?val :in $ ?key :where [?e ?key ?val]] db key))\n c-entity (first counter)\n c-val (inc (second counter))]\n [[:db/add (first counter) key c-val]\n [:db/add e attr (str prefix c-val)]])', term('Keyword(Symbol("params"))'): (term('Symbol("db")'), term('Symbol("e")'), term('Symbol("attr")'), term('Symbol("prefix")'))}) to Term |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment