Set For List Comparisons in F#

Dear Jamie Of The Future:

Next time you want to see if there are elements in 2 different lists, use Set

1 let tags0 = Set.ofList(["A";"B";"C"]) 2 let tags1 = Set.ofList(["A";"D"]) 3 let tags2 = Set.ofList(["A";"B"]) 4 let tags3 = Set.ofList(["D"]) 5 6 Set.intersect tags0 tags1 7 Set.intersect tags0 tags2 8 Set.intersect tags0 tags3

image

Love, Jamie of May 2015

PS.  You really should exercise more…

Advertisements

2 Responses to Set For List Comparisons in F#

  1. Also you can use standard operators like + and – to get unions etc. as well 🙂

  2. Pingback: F# Weekly #20, 2015 | Sergey Tihon's Blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: