I am coming from PowerShell and my idea is to pipe items from a list one-after-another.
PS> @(1,2,3,4) | ForEach-Object { Write-Output -InputObject $_ }
This is my naive attempt with direct translation but it pipes the whole list as an object.
> [4;5;6] |> printfn "%A";;
[4; 5; 6]
val it : unit = ()
I believe below is my closest attempt:
[4;5;6] |> List.map int x |> printfn "%i" x ;;
It throws me however the error:
[4;5;6] |> List.map int x |> printfn "%i" x ;;
-----------^^^^^^^^^^^^^^
stdin(31,12): error FS0001: This expression was expected to have type
'int list -> 'a'
but here has type
''b list'
How can I properly pipe items from a list?