16
从我所知道的,=和!=应该在OCaml中的字符串上工作。虽然我希望更好地理解,但我看到了奇怪的结果。OCaml意外的结果!=
当我比较两个字符串=我得到的结果我想到:
# "steve" = "steve";;
- : bool = true
# "steve" = "rowe";;
- : bool = false
但是当我尝试=我不行!
# "steve" != "rowe";;
- : bool = true
# "steve" != "steve";; (* unexpected - shouldn't this be false? *)
- : bool = true
谁能解释?有一个更好的方法吗?
前一个问题涵盖了一些微妙之处。 http://stackoverflow.com/questions/1412668/does-have-meaning-in-ocaml – nlucaroni 2010-06-17 22:05:03