Int.minInt and Int.maxInt are of type int option , not int .
This means that they can be either in the form of NONE , if there is no maximum (or minimum), or in the form of SOME v , where v is the maximum (or minimum).
There are many ways to get a value from an option.
- Matching pattern.
valOf , which retrieves the value. (note that throws an exception if NONE is specified)getOpt , which retrieves the value and uses the default value if set to NONE .
However, for this specific task, you can do this without the need for Int.minInt if you draw multiple input patterns. Also, be sure to consider the case when your input list is empty.
source share