jeudi 21 avril 2016

nested let and if statements

I am having issues understanding SML's syntax for nested lets and ifs. For example, why is this syntactically ill-formed?

fun stuff a =
  let
      val p = 2
  in
      if a = 1
      then
      let 
          val r = p 
      in
          a = r
      end
      else
      0
  end

if a is 1 then make a equal tor, if a is not 1, then do not create r in the first place and return 0. Kinda stupid, but o well...

So, why is this syntactically incorrect?

Aucun commentaire:

Enregistrer un commentaire