Skip to content

Commit

Permalink
#17 started crm lib
Browse files Browse the repository at this point in the history
  • Loading branch information
ojow committed Jun 15, 2018
1 parent dfd9bd6 commit d1ecdc3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 7 additions & 0 deletions re/src/crm/orc/crm.orc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
refer from core ((~), (||), (&&))

def and((p, p_immutable), (q, q_immutable)) =
(p && q, (p_immutable && q_immutable) || (~p && p_immutable) || (~q && q_immutable))
def or((p, p_immutable), (q, q_immutable)) =
(p || q, (p_immutable && q_immutable) || (p && p_immutable) || (q && q_immutable))
def not((p, p_immutable)) = (~p, p_immutable)
5 changes: 3 additions & 2 deletions re/src/re/handler/json2orc.clj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

(defn compile-orc [orc]
(shell/sh
"/usr/oam-compiler/_build/default/bin/orc.exe" "compile" "-prelude" "-i" "prelude"
"/usr/oam-compiler/_build/default/bin/orc.exe" "compile" "-prelude" "-i" "prelude" "-i" "/usr/app/src/crm/orc"
:dir "/usr/oam-compiler"
:in orc))

Expand All @@ -23,7 +23,8 @@
(defn convert [json]
(let [campaign (add-segments json)
orc (str (header campaign)
"\n1>>2")
"refer from crm (and, or, not)\n"
"and((true, true), not((true, true)))\n")
compile-result (compile-orc orc)
result {:orc orc}]
(if (= (:exit compile-result) 0)
Expand Down

0 comments on commit d1ecdc3

Please sign in to comment.