number_in_month exercise

前端 未结 4 1930
悲哀的现实
悲哀的现实 2021-01-17 04:17

I am fresh on SML and doing a homework by that. \"Write a function number_in_month that takes a list of dates and a month (i.e., an int) and returns how many dates in the li

4条回答
  •  -上瘾入骨i
    2021-01-17 04:53

    You can't bind variables "that way". A binding of a variable is a declaration and thus cannot be done where an expression is expected.

    In this case you have to use a let-in-end expression

    fun foo x = 
      let 
        val a = 42 
      in 
        a*x
      end 
    

提交回复
热议问题