test (Polyglot)¶

In [ ]:
//// test

open testing
In [ ]:
//// test
//// print_code

inl jp = [ "J"; "P" ]
inl tf = [ "T"; "F" ]
inl sn = [ "S"; "N" ]
inl ie = [ "I"; "E" ]

(ie, ([] : _ string))
||> listm.foldBack fun ie' acc =>
    inl ssnn acc' jp' =
        (sn, acc')
        ||> listm.foldBack fun sn' acc' =>
            inl c' ie' sn' tf' jp' =
                $'$"{!ie'}{!sn'}{!tf'}{!jp'}"'

            if listm.length acc' % 4i32 = 2 then
                (tf, acc')
                ||> listm.foldBack fun tf' acc'' =>
                    c' ie' sn' tf' jp' :: acc''
            else
                (acc', tf)
                ||> listm.fold fun acc'' tf' =>
                    c' ie' sn' tf' jp' :: acc''
    if acc = [] then
        (acc, jp)
        ||> listm.fold fun acc' jp' =>
            ssnn acc' jp'
    else
        (jp, acc)
        ||> listm.foldBack fun jp' acc' =>
            ssnn acc' jp'
|> listm'.box
|> listm'.to_array'
|> _assert_eq' ;[
    "ISTJ"; "ISFJ"; "INFJ"; "INTJ"
    "ISTP"; "ISFP"; "INFP"; "INTP"
    "ESTP"; "ESFP"; "ENFP"; "ENTP"
    "ESTJ"; "ESFJ"; "ENFJ"; "ENTJ"
]
type Mut0 = {mutable l0 : string}
let rec method1 (v0 : bool) : bool =
    v0
and method3 () : string =
    let v0 : string = ""
    v0
and closure0 (v0 : Mut0, v1 : string) () : unit =
    let v2 : string = v0.l0
    let v4 : string = v2 + v1 
    v0.l0 <- v4
    ()
and method2 (v0 : string, v1 : (string []), v2 : (string [])) : string =
    let v3 : string = method3()
    let v4 : Mut0 = {l0 = v3} : Mut0
    let v7 : string = "{ "
    let v8 : string = $"{v7}"
    let v16 : unit = ()
    let v17 : (unit -> unit) = closure0(v4, v8)
    let v18 : unit = (fun () -> v17 (); v16) ()
    let v26 : string = "name"
    let v27 : string = $"{v26}"
    let v35 : unit = ()
    let v36 : (unit -> unit) = closure0(v4, v27)
    let v37 : unit = (fun () -> v36 (); v35) ()
    let v45 : string = " = "
    let v46 : string = $"{v45}"
    let v54 : unit = ()
    let v55 : (unit -> unit) = closure0(v4, v46)
    let v56 : unit = (fun () -> v55 (); v54) ()
    let v63 : string = $"{v0}"
    let v71 : unit = ()
    let v72 : (unit -> unit) = closure0(v4, v63)
    let v73 : unit = (fun () -> v72 (); v71) ()
    let v81 : string = "; "
    let v82 : string = $"{v81}"
    let v90 : unit = ()
    let v91 : (unit -> unit) = closure0(v4, v82)
    let v92 : unit = (fun () -> v91 (); v90) ()
    let v100 : string = "actual"
    let v101 : string = $"{v100}"
    let v109 : unit = ()
    let v110 : (unit -> unit) = closure0(v4, v101)
    let v111 : unit = (fun () -> v110 (); v109) ()
    let v118 : string = $"{v45}"
    let v126 : unit = ()
    let v127 : (unit -> unit) = closure0(v4, v118)
    let v128 : unit = (fun () -> v127 (); v126) ()
    let v136 : string = $"%A{v1}"
    let v140 : string = $"{v136}"
    let v148 : unit = ()
    let v149 : (unit -> unit) = closure0(v4, v140)
    let v150 : unit = (fun () -> v149 (); v148) ()
    let v157 : string = $"{v81}"
    let v165 : unit = ()
    let v166 : (unit -> unit) = closure0(v4, v157)
    let v167 : unit = (fun () -> v166 (); v165) ()
    let v175 : string = "expected"
    let v176 : string = $"{v175}"
    let v184 : unit = ()
    let v185 : (unit -> unit) = closure0(v4, v176)
    let v186 : unit = (fun () -> v185 (); v184) ()
    let v193 : string = $"{v45}"
    let v201 : unit = ()
    let v202 : (unit -> unit) = closure0(v4, v193)
    let v203 : unit = (fun () -> v202 (); v201) ()
    let v211 : string = $"%A{v2}"
    let v215 : string = $"{v211}"
    let v223 : unit = ()
    let v224 : (unit -> unit) = closure0(v4, v215)
    let v225 : unit = (fun () -> v224 (); v223) ()
    let v233 : string = " }"
    let v234 : string = $"{v233}"
    let v242 : unit = ()
    let v243 : (unit -> unit) = closure0(v4, v234)
    let v244 : unit = (fun () -> v243 (); v242) ()
    let v250 : string = v4.l0
    v250
and closure1 (v0 : string) () : unit =
    let v1 : (string -> unit) = System.Console.WriteLine
    v1 v0
and method0 () : unit =
    let v0 : string = "E"
    let v1 : string = "N"
    let v2 : string = "T"
    let v3 : string = "J"
    let v4 : string = $"{v0}{v1}{v2}{v3}"
    let v5 : string = "F"
    let v6 : string = $"{v0}{v1}{v5}{v3}"
    let v7 : string = "S"
    let v8 : string = $"{v0}{v7}{v5}{v3}"
    let v9 : string = $"{v0}{v7}{v2}{v3}"
    let v10 : string = "P"
    let v11 : string = $"{v0}{v1}{v2}{v10}"
    let v12 : string = $"{v0}{v1}{v5}{v10}"
    let v13 : string = $"{v0}{v7}{v5}{v10}"
    let v14 : string = $"{v0}{v7}{v2}{v10}"
    let v15 : string = "I"
    let v16 : string = $"{v15}{v1}{v2}{v10}"
    let v17 : string = $"{v15}{v1}{v5}{v10}"
    let v18 : string = $"{v15}{v7}{v5}{v10}"
    let v19 : string = $"{v15}{v7}{v2}{v10}"
    let v20 : string = $"{v15}{v1}{v2}{v3}"
    let v21 : string = $"{v15}{v1}{v5}{v3}"
    let v22 : string = $"{v15}{v7}{v5}{v3}"
    let v23 : string = $"{v15}{v7}{v2}{v3}"
    let v24 : string list = []
    let v26 : string list = v4 :: v24 
    let v30 : string list = v6 :: v26 
    let v34 : string list = v8 :: v30 
    let v38 : string list = v9 :: v34 
    let v42 : string list = v11 :: v38 
    let v46 : string list = v12 :: v42 
    let v50 : string list = v13 :: v46 
    let v54 : string list = v14 :: v50 
    let v58 : string list = v16 :: v54 
    let v62 : string list = v17 :: v58 
    let v66 : string list = v18 :: v62 
    let v70 : string list = v19 :: v66 
    let v74 : string list = v20 :: v70 
    let v78 : string list = v21 :: v74 
    let v82 : string list = v22 :: v78 
    let v86 : string list = v23 :: v82 
    let v93 : (string list -> (string [])) = List.toArray
    let v94 : (string []) = v93 v86
    let v97 : string = "ISTJ"
    let v98 : string = "ISFJ"
    let v99 : string = "INFJ"
    let v100 : string = "INTJ"
    let v101 : string = "ISTP"
    let v102 : string = "ISFP"
    let v103 : string = "INFP"
    let v104 : string = "INTP"
    let v105 : string = "ESTP"
    let v106 : string = "ESFP"
    let v107 : string = "ENFP"
    let v108 : string = "ENTP"
    let v109 : string = "ESTJ"
    let v110 : string = "ESFJ"
    let v111 : string = "ENFJ"
    let v112 : string = "ENTJ"
    let v113 : (string []) = [|v97; v98; v99; v100; v101; v102; v103; v104; v105; v106; v107; v108; v109; v110; v111; v112|]
    let v115 : bool = v94 = v113 
    let v119 : bool =
        if v115 then
            true
        else
            method1(v115)
    let v120 : string = "__assert_eq'"
    let v121 : string = method2(v120, v94, v113)
    let v123 : unit = ()
    let v124 : (unit -> unit) = closure1(v121)
    let v125 : unit = (fun () -> v124 (); v123) ()
    let v127 : bool = v119 = false
    if v127 then
        failwith<unit> v121
method0()

{ name = __assert_eq'; actual = [|"ISTJ"; "ISFJ"; "INFJ"; "INTJ"; "ISTP"; "ISFP"; "INFP"; "INTP"; "ESTP"; "ESFP";
  "ENFP"; "ENTP"; "ESTJ"; "ESFJ"; "ENFJ"; "ENTJ"|]; expected = [|"ISTJ"; "ISFJ"; "INFJ"; "INTJ"; "ISTP"; "ISFP"; "INFP"; "INTP"; "ESTP"; "ESFP";
  "ENFP"; "ENTP"; "ESTJ"; "ESFJ"; "ENFJ"; "ENTJ"|] }
In [ ]:
//// test
//// print_code

inl i_e =
    listm'.replicate 8i32 "I" ++ listm'.replicate 8i32 "E"
inl s_n =
    [ "S"; "S"; "N"; "N" ]
    |> listm'.replicate 4i32
    |> listm'.collect id
inl t_f =
    [ "T"; "F"; "F"; "T" ]
    |> listm'.replicate 4i32
    |> listm'.collect id
inl j_p =
    [ "J"; "J"; "J"; "J" ]
    ++ [ "P"; "P"; "P"; "P" ]
    ++ [ "P"; "P"; "P"; "P" ]
    ++ [ "J"; "J"; "J"; "J" ]
inl mbti =
    listm'.map4 (fun a b c d => $'$"{!a}{!b}{!c}{!d}"') i_e s_n t_f j_p

mbti
|> listm'.box
|> listm'.to_array'
|> _assert_eq' ;[
    "ISTJ"; "ISFJ"; "INFJ"; "INTJ"
    "ISTP"; "ISFP"; "INFP"; "INTP"
    "ESTP"; "ESFP"; "ENFP"; "ENTP"
    "ESTJ"; "ESFJ"; "ENFJ"; "ENTJ"
]
type Mut0 = {mutable l0 : string}
let rec method1 (v0 : bool) : bool =
    v0
and method3 () : string =
    let v0 : string = ""
    v0
and closure0 (v0 : Mut0, v1 : string) () : unit =
    let v2 : string = v0.l0
    let v4 : string = v2 + v1 
    v0.l0 <- v4
    ()
and method2 (v0 : string, v1 : (string []), v2 : (string [])) : string =
    let v3 : string = method3()
    let v4 : Mut0 = {l0 = v3} : Mut0
    let v7 : string = "{ "
    let v8 : string = $"{v7}"
    let v16 : unit = ()
    let v17 : (unit -> unit) = closure0(v4, v8)
    let v18 : unit = (fun () -> v17 (); v16) ()
    let v26 : string = "name"
    let v27 : string = $"{v26}"
    let v35 : unit = ()
    let v36 : (unit -> unit) = closure0(v4, v27)
    let v37 : unit = (fun () -> v36 (); v35) ()
    let v45 : string = " = "
    let v46 : string = $"{v45}"
    let v54 : unit = ()
    let v55 : (unit -> unit) = closure0(v4, v46)
    let v56 : unit = (fun () -> v55 (); v54) ()
    let v63 : string = $"{v0}"
    let v71 : unit = ()
    let v72 : (unit -> unit) = closure0(v4, v63)
    let v73 : unit = (fun () -> v72 (); v71) ()
    let v81 : string = "; "
    let v82 : string = $"{v81}"
    let v90 : unit = ()
    let v91 : (unit -> unit) = closure0(v4, v82)
    let v92 : unit = (fun () -> v91 (); v90) ()
    let v100 : string = "actual"
    let v101 : string = $"{v100}"
    let v109 : unit = ()
    let v110 : (unit -> unit) = closure0(v4, v101)
    let v111 : unit = (fun () -> v110 (); v109) ()
    let v118 : string = $"{v45}"
    let v126 : unit = ()
    let v127 : (unit -> unit) = closure0(v4, v118)
    let v128 : unit = (fun () -> v127 (); v126) ()
    let v136 : string = $"%A{v1}"
    let v140 : string = $"{v136}"
    let v148 : unit = ()
    let v149 : (unit -> unit) = closure0(v4, v140)
    let v150 : unit = (fun () -> v149 (); v148) ()
    let v157 : string = $"{v81}"
    let v165 : unit = ()
    let v166 : (unit -> unit) = closure0(v4, v157)
    let v167 : unit = (fun () -> v166 (); v165) ()
    let v175 : string = "expected"
    let v176 : string = $"{v175}"
    let v184 : unit = ()
    let v185 : (unit -> unit) = closure0(v4, v176)
    let v186 : unit = (fun () -> v185 (); v184) ()
    let v193 : string = $"{v45}"
    let v201 : unit = ()
    let v202 : (unit -> unit) = closure0(v4, v193)
    let v203 : unit = (fun () -> v202 (); v201) ()
    let v211 : string = $"%A{v2}"
    let v215 : string = $"{v211}"
    let v223 : unit = ()
    let v224 : (unit -> unit) = closure0(v4, v215)
    let v225 : unit = (fun () -> v224 (); v223) ()
    let v233 : string = " }"
    let v234 : string = $"{v233}"
    let v242 : unit = ()
    let v243 : (unit -> unit) = closure0(v4, v234)
    let v244 : unit = (fun () -> v243 (); v242) ()
    let v250 : string = v4.l0
    v250
and closure1 (v0 : string) () : unit =
    let v1 : (string -> unit) = System.Console.WriteLine
    v1 v0
and method0 () : unit =
    let v0 : string = "I"
    let v1 : string = "S"
    let v2 : string = "T"
    let v3 : string = "J"
    let v4 : string = $"{v0}{v1}{v2}{v3}"
    let v5 : string = "F"
    let v6 : string = $"{v0}{v1}{v5}{v3}"
    let v7 : string = "N"
    let v8 : string = $"{v0}{v7}{v5}{v3}"
    let v9 : string = $"{v0}{v7}{v2}{v3}"
    let v10 : string = "P"
    let v11 : string = $"{v0}{v1}{v2}{v10}"
    let v12 : string = $"{v0}{v1}{v5}{v10}"
    let v13 : string = $"{v0}{v7}{v5}{v10}"
    let v14 : string = $"{v0}{v7}{v2}{v10}"
    let v15 : string = "E"
    let v16 : string = $"{v15}{v1}{v2}{v10}"
    let v17 : string = $"{v15}{v1}{v5}{v10}"
    let v18 : string = $"{v15}{v7}{v5}{v10}"
    let v19 : string = $"{v15}{v7}{v2}{v10}"
    let v20 : string = $"{v15}{v1}{v2}{v3}"
    let v21 : string = $"{v15}{v1}{v5}{v3}"
    let v22 : string = $"{v15}{v7}{v5}{v3}"
    let v23 : string = $"{v15}{v7}{v2}{v3}"
    let v24 : string list = []
    let v26 : string list = v23 :: v24 
    let v30 : string list = v22 :: v26 
    let v34 : string list = v21 :: v30 
    let v38 : string list = v20 :: v34 
    let v42 : string list = v19 :: v38 
    let v46 : string list = v18 :: v42 
    let v50 : string list = v17 :: v46 
    let v54 : string list = v16 :: v50 
    let v58 : string list = v14 :: v54 
    let v62 : string list = v13 :: v58 
    let v66 : string list = v12 :: v62 
    let v70 : string list = v11 :: v66 
    let v74 : string list = v9 :: v70 
    let v78 : string list = v8 :: v74 
    let v82 : string list = v6 :: v78 
    let v86 : string list = v4 :: v82 
    let v93 : (string list -> (string [])) = List.toArray
    let v94 : (string []) = v93 v86
    let v97 : string = "ISTJ"
    let v98 : string = "ISFJ"
    let v99 : string = "INFJ"
    let v100 : string = "INTJ"
    let v101 : string = "ISTP"
    let v102 : string = "ISFP"
    let v103 : string = "INFP"
    let v104 : string = "INTP"
    let v105 : string = "ESTP"
    let v106 : string = "ESFP"
    let v107 : string = "ENFP"
    let v108 : string = "ENTP"
    let v109 : string = "ESTJ"
    let v110 : string = "ESFJ"
    let v111 : string = "ENFJ"
    let v112 : string = "ENTJ"
    let v113 : (string []) = [|v97; v98; v99; v100; v101; v102; v103; v104; v105; v106; v107; v108; v109; v110; v111; v112|]
    let v115 : bool = v94 = v113 
    let v119 : bool =
        if v115 then
            true
        else
            method1(v115)
    let v120 : string = "__assert_eq'"
    let v121 : string = method2(v120, v94, v113)
    let v123 : unit = ()
    let v124 : (unit -> unit) = closure1(v121)
    let v125 : unit = (fun () -> v124 (); v123) ()
    let v127 : bool = v119 = false
    if v127 then
        failwith<unit> v121
method0()

{ name = __assert_eq'; actual = [|"ISTJ"; "ISFJ"; "INFJ"; "INTJ"; "ISTP"; "ISFP"; "INFP"; "INTP"; "ESTP"; "ESFP";
  "ENFP"; "ENTP"; "ESTJ"; "ESFJ"; "ENFJ"; "ENTJ"|]; expected = [|"ISTJ"; "ISFJ"; "INFJ"; "INTJ"; "ISTP"; "ISFP"; "INFP"; "INTP"; "ESTP"; "ESFP";
  "ENFP"; "ENTP"; "ESTJ"; "ESFJ"; "ENFJ"; "ENTJ"|] }
In [ ]:
//// test
//// print_code

fun i =>
    inl i_e =
        if i < 8
        then "I"
        else "E"
    inl s_n = 
        inl group = (i / 2) % 2
        if group = 0
        then "S"
        else "N"
    inl t_f =
        match i % 4 with
        | 0 => "T"
        | 1 => "F"
        | 2 => "F"
        | _ => "T"
    inl j_p =
        if i < 4
        then "J"
        elif i < 12
        then "P"
        else "J"
    $'$"{!i_e}{!s_n}{!t_f}{!j_p}"'
|> listm.init 16i32
|> listm'.box
|> listm'.to_array'
|> _assert_eq' ;[
    "ISTJ"; "ISFJ"; "INFJ"; "INTJ"
    "ISTP"; "ISFP"; "INFP"; "INTP"
    "ESTP"; "ESFP"; "ENFP"; "ENTP"
    "ESTJ"; "ESFJ"; "ENFJ"; "ENTJ"
]
type Mut0 = {mutable l0 : string}
let rec method1 (v0 : bool) : bool =
    v0
and method3 () : string =
    let v0 : string = ""
    v0
and closure0 (v0 : Mut0, v1 : string) () : unit =
    let v2 : string = v0.l0
    let v4 : string = v2 + v1 
    v0.l0 <- v4
    ()
and method2 (v0 : string, v1 : (string []), v2 : (string [])) : string =
    let v3 : string = method3()
    let v4 : Mut0 = {l0 = v3} : Mut0
    let v7 : string = "{ "
    let v8 : string = $"{v7}"
    let v16 : unit = ()
    let v17 : (unit -> unit) = closure0(v4, v8)
    let v18 : unit = (fun () -> v17 (); v16) ()
    let v26 : string = "name"
    let v27 : string = $"{v26}"
    let v35 : unit = ()
    let v36 : (unit -> unit) = closure0(v4, v27)
    let v37 : unit = (fun () -> v36 (); v35) ()
    let v45 : string = " = "
    let v46 : string = $"{v45}"
    let v54 : unit = ()
    let v55 : (unit -> unit) = closure0(v4, v46)
    let v56 : unit = (fun () -> v55 (); v54) ()
    let v63 : string = $"{v0}"
    let v71 : unit = ()
    let v72 : (unit -> unit) = closure0(v4, v63)
    let v73 : unit = (fun () -> v72 (); v71) ()
    let v81 : string = "; "
    let v82 : string = $"{v81}"
    let v90 : unit = ()
    let v91 : (unit -> unit) = closure0(v4, v82)
    let v92 : unit = (fun () -> v91 (); v90) ()
    let v100 : string = "actual"
    let v101 : string = $"{v100}"
    let v109 : unit = ()
    let v110 : (unit -> unit) = closure0(v4, v101)
    let v111 : unit = (fun () -> v110 (); v109) ()
    let v118 : string = $"{v45}"
    let v126 : unit = ()
    let v127 : (unit -> unit) = closure0(v4, v118)
    let v128 : unit = (fun () -> v127 (); v126) ()
    let v136 : string = $"%A{v1}"
    let v140 : string = $"{v136}"
    let v148 : unit = ()
    let v149 : (unit -> unit) = closure0(v4, v140)
    let v150 : unit = (fun () -> v149 (); v148) ()
    let v157 : string = $"{v81}"
    let v165 : unit = ()
    let v166 : (unit -> unit) = closure0(v4, v157)
    let v167 : unit = (fun () -> v166 (); v165) ()
    let v175 : string = "expected"
    let v176 : string = $"{v175}"
    let v184 : unit = ()
    let v185 : (unit -> unit) = closure0(v4, v176)
    let v186 : unit = (fun () -> v185 (); v184) ()
    let v193 : string = $"{v45}"
    let v201 : unit = ()
    let v202 : (unit -> unit) = closure0(v4, v193)
    let v203 : unit = (fun () -> v202 (); v201) ()
    let v211 : string = $"%A{v2}"
    let v215 : string = $"{v211}"
    let v223 : unit = ()
    let v224 : (unit -> unit) = closure0(v4, v215)
    let v225 : unit = (fun () -> v224 (); v223) ()
    let v233 : string = " }"
    let v234 : string = $"{v233}"
    let v242 : unit = ()
    let v243 : (unit -> unit) = closure0(v4, v234)
    let v244 : unit = (fun () -> v243 (); v242) ()
    let v250 : string = v4.l0
    v250
and closure1 (v0 : string) () : unit =
    let v1 : (string -> unit) = System.Console.WriteLine
    v1 v0
and method0 () : unit =
    let v0 : string = "I"
    let v1 : string = "S"
    let v2 : string = "T"
    let v3 : string = "J"
    let v4 : string = $"{v0}{v1}{v2}{v3}"
    let v5 : string = "F"
    let v6 : string = $"{v0}{v1}{v5}{v3}"
    let v7 : string = "N"
    let v8 : string = $"{v0}{v7}{v5}{v3}"
    let v9 : string = $"{v0}{v7}{v2}{v3}"
    let v10 : string = "P"
    let v11 : string = $"{v0}{v1}{v2}{v10}"
    let v12 : string = $"{v0}{v1}{v5}{v10}"
    let v13 : string = $"{v0}{v7}{v5}{v10}"
    let v14 : string = $"{v0}{v7}{v2}{v10}"
    let v15 : string = "E"
    let v16 : string = $"{v15}{v1}{v2}{v10}"
    let v17 : string = $"{v15}{v1}{v5}{v10}"
    let v18 : string = $"{v15}{v7}{v5}{v10}"
    let v19 : string = $"{v15}{v7}{v2}{v10}"
    let v20 : string = $"{v15}{v1}{v2}{v3}"
    let v21 : string = $"{v15}{v1}{v5}{v3}"
    let v22 : string = $"{v15}{v7}{v5}{v3}"
    let v23 : string = $"{v15}{v7}{v2}{v3}"
    let v24 : string list = []
    let v26 : string list = v23 :: v24 
    let v30 : string list = v22 :: v26 
    let v34 : string list = v21 :: v30 
    let v38 : string list = v20 :: v34 
    let v42 : string list = v19 :: v38 
    let v46 : string list = v18 :: v42 
    let v50 : string list = v17 :: v46 
    let v54 : string list = v16 :: v50 
    let v58 : string list = v14 :: v54 
    let v62 : string list = v13 :: v58 
    let v66 : string list = v12 :: v62 
    let v70 : string list = v11 :: v66 
    let v74 : string list = v9 :: v70 
    let v78 : string list = v8 :: v74 
    let v82 : string list = v6 :: v78 
    let v86 : string list = v4 :: v82 
    let v93 : (string list -> (string [])) = List.toArray
    let v94 : (string []) = v93 v86
    let v97 : string = "ISTJ"
    let v98 : string = "ISFJ"
    let v99 : string = "INFJ"
    let v100 : string = "INTJ"
    let v101 : string = "ISTP"
    let v102 : string = "ISFP"
    let v103 : string = "INFP"
    let v104 : string = "INTP"
    let v105 : string = "ESTP"
    let v106 : string = "ESFP"
    let v107 : string = "ENFP"
    let v108 : string = "ENTP"
    let v109 : string = "ESTJ"
    let v110 : string = "ESFJ"
    let v111 : string = "ENFJ"
    let v112 : string = "ENTJ"
    let v113 : (string []) = [|v97; v98; v99; v100; v101; v102; v103; v104; v105; v106; v107; v108; v109; v110; v111; v112|]
    let v115 : bool = v94 = v113 
    let v119 : bool =
        if v115 then
            true
        else
            method1(v115)
    let v120 : string = "__assert_eq'"
    let v121 : string = method2(v120, v94, v113)
    let v123 : unit = ()
    let v124 : (unit -> unit) = closure1(v121)
    let v125 : unit = (fun () -> v124 (); v123) ()
    let v127 : bool = v119 = false
    if v127 then
        failwith<unit> v121
method0()

{ name = __assert_eq'; actual = [|"ISTJ"; "ISFJ"; "INFJ"; "INTJ"; "ISTP"; "ISFP"; "INFP"; "INTP"; "ESTP"; "ESFP";
  "ENFP"; "ENTP"; "ESTJ"; "ESFJ"; "ENFJ"; "ENTJ"|]; expected = [|"ISTJ"; "ISFJ"; "INFJ"; "INTJ"; "ISTP"; "ISFP"; "INFP"; "INTP"; "ESTP"; "ESFP";
  "ENFP"; "ENTP"; "ESTJ"; "ESFJ"; "ENFJ"; "ENTJ"|] }
In [ ]:
type PhonologicalFeature =
    | VowelFeature of
        height: Height
        * backness: Backness
        * roundedness: Roundedness
        * tone: Option<Tone>
        * stress: Option<Stress>
        * length: Option<Length>
    | ConsonantFeature of
        place: PlaceOfArticulation
        * manner: MannerOfArticulation
        * voicing: Voicing
        * length: Option<Length>
    | VowelHarmonyFeature
    | PitchAccentFeature

and Stress = Primary | Secondary
and Length = Long | Short | HalfLong

and Height =
    | High | NearHigh | HighMid
    | Mid | LowMid | NearLow
    | Low

and Backness = Front | Central | Back

and Roundedness = Rounded | Unrounded

and PlaceOfArticulation =
    | Bilabial | Labiodental | Dental
    | Alveolar | Postalveolar | Retroflex
    | Palatal | Velar | Uvular
    | Pharyngeal | Epiglottal | Glottal

and MannerOfArticulation =
    | Plosive | Nasal | Trill
    | TapOrFlap | Fricative | LateralFricative
    | Approximant | LateralApproximant

and Voicing = Voiced | Voiceless

and SecondaryArticulation =
    | Labialization | Palatalization | Velarization
    | Pharyngealization | Aspiration

and Tone =
    | LevelTone of int
    | ContourTone of int list

and MorphologicalFeature =
    | RootFeature of string
    | AffixFeature of AffixType * string
    | IncorporationFeature of string * MorphologicalFeature
    | NonConcatenativePattern of string * string
    | AgglutinativeAffixFeature of AgglutinativeAffixType * string
    | HonorificFeature of HonorificType * string

and AgglutinativeAffixType = Suffix | Prefix

and HonorificType = VerbHonorific | NounHonorific

and AffixType =
    | Prefix | Suffix | Infix
    | Circumfix

type SyntacticFeature =
    | WordFeature of MorphologicalFeature list * LexicalCategory
    | PhraseFeature of PhraseType * SyntacticFeature list
    | GrammaticalRelation of GrammaticalRelationType * SyntacticFeature list
    | SOVOrderFeature
    | TopicCommentFeature

and GrammaticalRelationType =
    | Ergative | Absolutive | Nominative
    | Accusative

and LexicalCategory =
    | Noun | Verb | Adjective
    | Adverb | Pronoun | Preposition
    | Conjunction | Determiner | Interjection

and PhraseType =
    | NP | VP | AP
    | PP | CP

and SemanticFeature =
    | Meaning of string
    | SemanticRole of SemanticRoleType * SemanticFeature

and SemanticRoleType =
    | Agent | Patient | Instrument
    | Location | Time | Cause

and PragmaticFeature =
    | UseContext of string
    | PolitenessLevel of Politeness
    | SpeechAct of SpeechActType
    | SpeechLevel of SpeechLevelType

and Politeness = Formal | Informal | Neutral

and SpeechActType =
    | Assertive | Directive | Commissive
    | Expressive | Declarative

and SpeechLevelType =
    | FormalHigh | FormalLow | InformalHigh
    | InformalLow | Neutral

type LinguisticFeature =
    | Phonological of PhonologicalFeature
    | Morphological of MorphologicalFeature
    | Syntactic of SyntacticFeature
    | Semantic of SemanticFeature
    | Pragmatic of PragmaticFeature

type LanguageConstruct =
    | LanguageElement of LinguisticFeature
    | LanguageStructure of LanguageConstruct list
    | TranslationElement of TranslationFeature

and TranslationFeature =
    | LinkedPhonological of PhonologicalFeature * PhonologicalFeature
    | LinkedMorphological of MorphologicalFeature * MorphologicalFeature
    | LinkedSyntactic of SyntacticFeature * SyntacticFeature
    | LinkedSemantic of SemanticFeature * SemanticFeature

type Discourse = DiscourseUnit of LanguageConstruct list

type LanguageModel =
    | Model of discourse: Discourse
In [ ]:
let testEnglish =
    Model(
        DiscourseUnit [
            LanguageElement (Phonological (ConsonantFeature (Alveolar, Nasal, Voiced, Some(HalfLong))));
            LanguageElement (Phonological (VowelFeature (High, Front, Unrounded, Some(LevelTone 1), Some(Primary), Some(Short))));
            LanguageElement (Phonological (VowelFeature (Low, Front, Unrounded, Some(LevelTone 2), Some(Secondary), Some(Long))));
            LanguageElement (Phonological (ConsonantFeature (Velar, Plosive, Voiceless, Some(HalfLong))));
            LanguageElement (Morphological (RootFeature "I"));
            LanguageElement (Morphological (RootFeature "see"));
            LanguageElement (Morphological (RootFeature "a"));
            LanguageElement (Morphological (RootFeature "cat"));
            LanguageElement (Syntactic (PhraseFeature (NP, [WordFeature ([RootFeature "I"], Pronoun)])));
            LanguageElement (Syntactic (PhraseFeature (VP, [WordFeature ([RootFeature "see"], Verb)])));
            LanguageElement (Syntactic (PhraseFeature (NP, [WordFeature ([RootFeature "a"; RootFeature "cat"], Noun)])));
            LanguageElement (Semantic (Meaning "Perception act of a feline by the speaker"));
            LanguageElement (Pragmatic (UseContext "Statement of an action being observed"))
        ]
    )

let testPortuguese =
    Model(
        DiscourseUnit [
            LanguageElement (Phonological (VowelFeature (High, Front, Unrounded, Some(LevelTone 1), Some(Primary), Some(Short))));
            LanguageElement (Phonological (VowelFeature (Low, Front, Unrounded, Some(LevelTone 2), Some(Secondary), Some(Long))));
            LanguageElement (Phonological (VowelFeature (Mid, Back, Rounded, Some(LevelTone 3), Some(Primary), Some(Short))));
            LanguageElement (Phonological (ConsonantFeature (Velar, Plosive, Voiceless, Some(HalfLong))));
            LanguageElement (Morphological (RootFeature "Eu"));
            LanguageElement (Morphological (RootFeature "ver" |> ignore; AffixFeature (Suffix, "o")));
            LanguageElement (Morphological (RootFeature "um"));
            LanguageElement (Morphological (RootFeature "gato"));
            LanguageElement (Syntactic (PhraseFeature (NP, [WordFeature ([RootFeature "Eu"], Pronoun)])));
            LanguageElement (Syntactic (PhraseFeature (VP, [WordFeature ([RootFeature "vejo"], Verb)])));
            LanguageElement (Syntactic (PhraseFeature (NP, [WordFeature ([RootFeature "um"; RootFeature "gato"], Noun)])));
            LanguageElement (Semantic (Meaning "Ação de percepção de um felino pelo falante"));
            LanguageElement (Pragmatic (UseContext "Declaração de uma ação sendo observada"))
        ]
    )

let testKorean =
    Model(
        DiscourseUnit [
            LanguageElement (Phonological (ConsonantFeature (Alveolar, Nasal, Voiced, Some(Short))));
            LanguageElement (Phonological (VowelFeature (High, Back, Rounded, None, None, Some(Short))));
            LanguageElement (Phonological (VowelFeature (Mid, Front, Unrounded, None, None, Some(Long))));
            LanguageElement (Phonological (ConsonantFeature (Bilabial, Plosive, Voiceless, Some(Short))));
            LanguageElement (Morphological (RootFeature "나"));
            LanguageElement (Morphological (RootFeature "보다"));
            LanguageElement (Morphological (AffixFeature (Suffix, "아")));
            LanguageElement (Morphological (RootFeature "고양이"));
            LanguageElement (Syntactic (PhraseFeature (NP, [WordFeature ([RootFeature "나"], Pronoun)])));
            LanguageElement (Syntactic (PhraseFeature (VP, [WordFeature ([RootFeature "보다"; AffixFeature (Suffix, "아")], Verb)])));
            LanguageElement (Syntactic (PhraseFeature (NP, [WordFeature ([RootFeature "고양이"], Noun)])));
            LanguageElement (Semantic (Meaning "화자에 의한 고양이의 관찰 행위"));
            LanguageElement (Pragmatic (UseContext "관찰되고 있는 행동의 진술"))
        ]
    )

main¶

In [ ]:
inl main (_args : array_base string) =
    0i32

inl main () =
    $'let main args = !main args' : ()
In [ ]:
inl app () =
    "test" |> console.write_line
    0i32

inl main () =
    print_static "<test>"

    app
    |> dyn
    |> ignore

    print_static "</test>"