Skip to content

Instantly share code, notes, and snippets.

@tucaz
Created December 28, 2010 20:36
Show Gist options
  • Save tucaz/757678 to your computer and use it in GitHub Desktop.
Save tucaz/757678 to your computer and use it in GitHub Desktop.
Comparativo C# v.s. F#
//C#
public T FindInList(List<T> source, List<T> target>
{
foreach(T item in source)
{
foreach(T targ in target)
{
if(item == targ)
return item
}
}
}
//F#
let findInList source target =
source |> List.pick (fun s -> target |> List.tryFind (fun (y,_) -> y = s))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment