Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
meander map construction.clj
(defn oprmbinds-mk [a_arg a_valmap]
(let
[extractPrmVal (fn [m k d] (get m k d))]
(m/rewrite
a_arg
(:makeparmbinds ?valmap [{(m/or :name :fldname) (m/and !prmn1 !prmn2 !prmn3)
:ctype {:ctuid !prmctuid}} ...])
(m/map-of !prmn1 {:prmName !prmn2
:prmCtuid !prmctuid
:prmBind (m/app extractPrmVal ?valmap !prmn3 :prmbnd-none)})
(:oprmsbindvals ?valmap (m/map-of _ {:prmName (m/and !prmn1 !prmn2 !prmn3) :prmCtuid !prmctuid :prmBind !prmBind}))
(m/map-of !prmn1 {:prmName !prmn2
:prmCtuid !prmctuid
:prmBind (m/app extractPrmVal ?valmap !prmn3 !prmBind)})
{:inputs (m/some ?inputs)
:outputs (m/some ?outputs)}
(m/app
->opmirOprmbinds
{:oprmins (m/cata (:makeparmbinds ~(:in a_valmap) ?inputs))
:oprmouts (m/cata (:makeparmbinds ~(:out a_valmap) ?outputs))})
{:op :opmirDefOp
:oprmbinds {:oprmins ?oprmins
:oprmouts ?oprmouts}}
{:oprmins (m/cata (:oprmsbindvals ~(:in a_valmap) ?oprmins))
:oprmouts (m/cata (:oprmsbindvals ~(:out a_valmap) ?oprmouts))}
{:op :opmirCtypeMeta
:fields ?ctypeFlds}
(m/cata {:inputs ?ctypeFlds
:outputs []})
?x
~(matchFailEx! ?x))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment