PDA

View Full Version : another SML code


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

Smerdyakov
04-11-2004, 01:35 AM
This error is just too obvious. Please look at your code more carefully.

edeita2
04-11-2004, 12:38 PM
Originally posted by Smerdyakov
This error is just too obvious. Please look at your code more carefully.
is it x = NONE then print " Not Found!" ?

edeita2
04-11-2004, 08:08 PM
this problem has been done, ignore it