Modest opinions  
by a humble autodidact

 

let str = "blah"

match input with

| str -> // input = "blah" ?

| _ -> // otherwise

 

这样写是不对的, str在这个位置并不会被bind到变量str上,而是会和任何输入匹配,匹配的结果进入新的变量strstr在它的scope(the match clause)中遮蔽str。应该这样写:

 

match input with

| x when x=str -> // input = "blah"


 

 


posted on 2008-07-21 10:11  yushih  阅读(174)  评论(0编辑  收藏  举报