Nested case statements in SML

后端 未结 3 852
深忆病人
深忆病人 2021-02-19 00:03

This is more of a stylistic question than anything else. Given the following piece of code:

case e1 of                    (* datatype type_of_e1  = p1 | p2 *)
           


        
3条回答
  •  忘了有多久
    2021-02-19 00:58

    The answer is "(" and ")". My example:

    case e1 of                   
       p1 => ( case e11 of         
                  NONE => expr11
                  | SOME v => expr12 v )
       | p2 => ( case e21 of         
                    NONE => expr21
                    | SOME v => expr22 v )
    

    This really works! Cool :) You can try it too.

提交回复
热议问题