Skip to content

Commit

Permalink
Add conditional event
Browse files Browse the repository at this point in the history
  • Loading branch information
soegaard committed Jan 17, 2024
1 parent f24303b commit 6c8e295
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions racket-cas/format.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,7 @@
[(list 'Union u v) (~a "{{" (v~ u) "}" (~setop 'Union) "{" (v~ v) "}}")]
[(list 'Intersection u v) (~a "{{" (v~ u) "}" (~setop 'Intersection) "{" (v~ v) "}}")]
[(list 'Difference u v) (~a "{{" (v~ u) "}" (~setop 'Difference) "{" (v~ v) "}}")]
[(list 'Conditional u v) (~a "{{" (v~ u) "}|{" (v~ v) "}}")] ; conditional prob. as in P(A|B)

[(list 'int u v) (cond
[(or (and (number? u) (negative? u))
Expand Down Expand Up @@ -769,6 +770,7 @@
[(list 'Union u v) (~a "{{" (v~ u) "}" (~setop 'Union) "{" (v~ v) "}}")]
[(list 'Intersection u v) (~a "{{" (v~ u) "}" (~setop 'Intersection) "{" (v~ v) "}}")]
[(list 'Difference u v) (~a "{{" (v~ u) "}" (~setop 'Difference) "{" (v~ v) "}}")]
[(list 'Conditional u v) (~a "{{" (v~ u) "}|{" (v~ v) "}}")] ; conditional prob. as in P(A|B)
[u (v~ u) ]))
(when debugging? (write (list 'v~ u 'orig original?)) (newline))
(math-match u
Expand Down Expand Up @@ -949,6 +951,7 @@
[(list 'Union u v) (~a "{{" (v~ u) "}" (~setop 'Union) "{" (v~ v) "}}")]
[(list 'Intersection u v) (~a "{{" (v~ u) "}" (~setop 'Intersection) "{" (v~ v) "}}")]
[(list 'Difference u v) (~a "{{" (v~ u) "}" (~setop 'Difference) "{" (v~ v) "}}")]
[(list 'Conditional u v) (~a "{{" (v~ u) "}|{" (v~ v) "}}")] ; conditional prob. as in P(A|B)

[(App u v) (match u
[(? symbol? f) (~a f "(" (v~ v) ")")]
Expand Down

0 comments on commit 6c8e295

Please sign in to comment.