I have been attempting the Eulers in F#* and am currently on #5. My problem is using a function that takes more than one parameter in a pipeline operation.
This function correctly returns whether the first parameter is divisible by every member of an array which is the second parameter:
let isDivisibleBy seq n =
seq
|> Seq.forall (fun x -> n % x = 0)
isDivisibleBy [|1 .. 10|] 2520 //true
However, the following statement does not work:
Seq.initInfinite
|> Seq.find isDivisibleBy [|1 .. 10|]
I get the following error:
error FS0001: The type '((int -> 'c) -> seq<'c>) -> 'd' is not compatible with the type 'seq<'a>'
*"2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?"