I'm new with F#. I'm trying to create an F# program transforming a number to its roman numeral counterpart.
type RomanDigit = I | IV | V | IX
let rec romanNumeral number =
let values = [ 9; 5; 4; 1 ]
let toRomanDigit x =
match x with
| 9 -> IX
| 5 -> V
| 4 -> IV
| 1 -> I
let capture x =
values
|> Seq.find ( fun x -> number >= x )
match number with
| 0 -> []
| int -> Seq.toList ( Seq.concat [ [ toRomanDigit capture ]; romanNumeral ( number - capture ) ] )
My problem here is that capture has the type 'a -> int, but I expect it to have the type int, considering Seq.find will return an int. Particularly, my subsequent calls to capture throws an error particularly in:
| int -> Seq.toList ( Seq.concat [ [ toRomanDigit capture ]; romanNumeral ( number - capture ) ] )
What am I doing wrong?