4. type Expression =
| Math of Expression list
| Menclose of Expression list
| Mrow of Expression list
| Mi of string
| MiNormal of string
| Mo of string
| Mtd of Expression list
| Mtr of Expression list
| Mn of string
Mn(42) | Mroot of Expression * Expression
| Mfrac of Expression * Expression
| Msub of Expression * Expression
| Msup of Expression * Expression
Mi(
(etc.)
Mfrac(Mn(1),Mn(2))
Mtd([…])
5. l e t c a s e s = R e f l e c t i o n . F S h a r p Typ e . G e t U n i o n C a s e s ( t yp e o f <E xp r e s s i o n >)
|> A r r a y. m ap ( f u n f - > ( f . N a me ,
R e f l e c t i o n .F S h a r p Va l u e . P r e C o mp u t e U n i o n C o n s t r u c to r ( f) ) )
|> M a p . o f A r r a y
let ctor = cases.Item name
(ctor parameters) :?> Expression
0 (* sorry, supporting integrals is just too hard *)
15.
| "E" | "ⅇ" | "e" when settings.EIsConstant
| Mo(op) :: (UnitOfMeasureBraces(units) as uu) :: t
let rec (|Simple|_|) = function
| SimpleAndPhysical x -> Some x
| Mrow(content) ->
match content with
| Simple h :: [] -> Some h
| _ -> None
| _ -> None
let (<@>) (dictName:Map<_,_>) keyName =
if dictName.ContainsKey keyName then dictName.[keyName]
else keyName