Skip to content

Commit

Permalink
Provenance hack
Browse files Browse the repository at this point in the history
  • Loading branch information
prabhanshuguptagit committed Jan 6, 2024
1 parent 11aadd8 commit 67642e3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/bean/provenance.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@
(sub-ast-proof op)
(sub-ast-proof right)))
(sub-ast-proof arg))
:FunctionInvocation (do
[:function-invocation
(second arg)
(sub-ast-proof (first (rest args)))])
:Value (sub-ast-proof arg)
:Integer (self-evident (scalar))
:String (self-evident (scalar))
Expand All @@ -64,6 +68,7 @@

(defn- spilled-cell-proof [address cell {:keys [grid] :as sheet}]
(let [spilled-from (util/get-cell grid (:spilled-from cell))]
(prn (:matrix (ast-proof (:ast spilled-from) sheet)))
(conj
[:spill
{:spilled-from (:spilled-from cell)
Expand Down
4 changes: 4 additions & 0 deletions src/bean/ui/provenance.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@
[(str s (case proof-type
:scalar (str p " ")
:spill (str (apply util/rc->a1 (:address p)) " ")
:function-invocation (str p "(x)")
:cell-ref (str (apply util/rc->a1 (:address p)) " ")))
(if (coll? (first rest))
(conj queue subproof)
queue)]))
(case _
:scalar [(str proof " is ") []]
:spill [(str (apply util/rc->a1 (:address proof)) " is ") []]
:function-invocation [(str "x is " (second proof)) []]
:cell-ref [(str (apply util/rc->a1 (:address proof)) " is ") []])
dependency-proofs)]
(if (first que)
Expand All @@ -32,10 +34,12 @@
(let [proof-tree (provenance/ast-proof
(parser/parse (str "=" expression))
sheet)
x (prn proof-tree)
[proof-type proof & dependency-proofs] proof-tree
sproof (case proof-type
:scalar (str "it's " proof)
:spill (str "it's " (:scalar proof))
:function-invocation (str "it's " (second proof) "(" proof ")")
:cell-ref (str (apply util/rc->a1 (:address proof)) " is " (:scalar proof)))]
(if (coll? (first dependency-proofs))
(str sproof " because\n" (subtree-proof-sentence "" proof-tree))
Expand Down

0 comments on commit 67642e3

Please sign in to comment.