I can define a simple list in F# as follows and iterate over it with the following code:
let ar = [0;1;2;3]
ar |> Seq.iter (fun x -> printfn "Ar: %A" x)
Now consider a nested sequence as follows:
let ar1 = [1;2;3;4]
let ar2 = [5;6;7;8]
let nested_array = [ar1; ar2]
How can I Iterate over this – the following code below gets an error:
‘Unexpected infix operator in lambda expression’
What I’m trying to do here is to iterate over the outer sequence and pipe that forward to a second iterator which then lets me access the contents of the inner arrays.
nested_array |>
Seq.iter (fun x -> |>
Seq.iter (fun y ->
printfn "Ar: %A" y))
What am I missing here – I suspect a syntax problem or (more serious/likely) a lack of F#/FP comprehension .
You’re not using your variable
x. Try eitheror (eliminating the use of
xentirely)or even (eliminating
yas well)