mirror of
https://github.com/CatalaLang/catala.git
synced 2024-09-16 14:57:13 +03:00
Tweak printing of if/then/else
This commit is contained in:
parent
4ae949f7f8
commit
3cb8fc1499
@ -586,7 +586,8 @@ let rec expr_aux :
|
||||
| EIfThenElse _ ->
|
||||
let rec pr els fmt = function
|
||||
| EIfThenElse { cond; etrue; efalse }, _ ->
|
||||
Format.fprintf fmt "@[<hv 2>%a@ %a@]@ @[<hv 2>%a@ %a@]@ %a" keyword
|
||||
Format.fprintf fmt "@[<hv 2>@[<hv 2>%a@ %a@;<1 -2>%a@]@ %a@]@ %a"
|
||||
keyword
|
||||
(if els then "else if" else "if")
|
||||
expr cond keyword "then" expr etrue (pr true) efalse
|
||||
| e -> Format.fprintf fmt "@[<hv 2>%a@ %a@]" keyword "else" (rhs exprc) e
|
||||
|
@ -71,7 +71,8 @@ let scope S (x: integer|internal|output) =
|
||||
to_rat ((2 - i) * (2 - i)))
|
||||
< let i : integer = i_2 in
|
||||
to_rat ((2 - i) * (2 - i))
|
||||
then i_1
|
||||
then
|
||||
i_1
|
||||
else i_2)
|
||||
42
|
||||
[ 1; 2; 3 ])
|
||||
|
@ -34,8 +34,8 @@ let scope S
|
||||
| ESome y_0 →
|
||||
let potential_max_1 : integer = y_0 in
|
||||
let potential_max_2 : integer = y_3 in
|
||||
if potential_max_1 < potential_max_2
|
||||
then ESome potential_max_1
|
||||
if potential_max_1 < potential_max_2 then
|
||||
ESome potential_max_1
|
||||
else ESome potential_max_2)
|
||||
ESome -1
|
||||
y_2)
|
||||
@ -83,8 +83,8 @@ let scope S
|
||||
| ESome y_0 →
|
||||
let potential_max_1 : integer = y_0 in
|
||||
let potential_max_2 : integer = y_3 in
|
||||
if potential_max_1 < potential_max_2
|
||||
then ESome potential_max_1
|
||||
if potential_max_1 < potential_max_2 then
|
||||
ESome potential_max_1
|
||||
else ESome potential_max_2)
|
||||
ESome -1
|
||||
y_2))
|
||||
|
@ -171,8 +171,7 @@ let scope Foo
|
||||
(match b with
|
||||
| ENone _ → ENone _
|
||||
| ESome b →
|
||||
if b
|
||||
then
|
||||
if b then
|
||||
match
|
||||
(match (SubFoo1 { SubFoo1_in x_in = ESome 10; }).x with
|
||||
| ENone _ → ENone _
|
||||
|
Loading…
Reference in New Issue
Block a user