0

This code is giving error FS0001: This expression was expected to have type 'string' but here has type ''a * 'b'

open System 
open System.Linq

let list1 = [ "one"; "two"; "three" ]
let list2 = [ "one"; "two"; "three" ]

let tablesValidation (l1 : string list) (l2 : string list) =
    printfn "%O" l1
    printfn "%O" l2


tablesValidation(list1,list2)
Console.ReadKey() |> ignore

1 Answer 1

1

In F#, function arguments do not need parentheses and are separated by spaces. Change it to this:

tablesValidation list1 list2

Your original version passed a tuple value as a single parameter, hence the error message, where a * b means a tuple with two fields.

Sign up to request clarification or add additional context in comments.

5 Comments

One more question @Chad Gibert what is the alternative of Expect of linq in f# ?
If you're talking about emulating Except in Linq, you may want to try F#'s Seq.filter
Yes, exactly I am trying the same :)
For example, if I want to apply the same in my above mention code then how could I?
You could define a custom except function like this: let except a b = let set = Set b in Seq.filter (not << set.Contains) a

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.