edeita2
04-10-2004, 02:43 PM
In the following code, I`m trying to get true or false for the existence of a given element in the list, how come it brings me "Found" although it`s not there? Problem:
Create a list of states and check if a given state is in that list. Here we go:
val x = ["New York", "Boston", "Detroit", "Toronto", "Montreal", "Chicago"];
val x = ["New York","Boston","Detroit","Toronto","Montreal","Chicago"]
: string list
- if List.find(fn x => x = "Philadelhia") x = NONE then print "FOUND" else print "NOT FOUND";
FOUNDval it = () : unit
Create a list of states and check if a given state is in that list. Here we go:
val x = ["New York", "Boston", "Detroit", "Toronto", "Montreal", "Chicago"];
val x = ["New York","Boston","Detroit","Toronto","Montreal","Chicago"]
: string list
- if List.find(fn x => x = "Philadelhia") x = NONE then print "FOUND" else print "NOT FOUND";
FOUNDval it = () : unit