Advertisement
Guest User

s

a guest
Feb 28th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
F# 0.49 KB | None | 0 0
  1. let rec foo2 func value list =
  2.     match list with
  3.     | [] -> []
  4.     | x::xs ->
  5.         if func = "eq" then
  6.             if x = value then x::(foo2 func value xs)
  7.             else foo2 func value xs
  8.  
  9.         else if func = "lt" then
  10.             if x > value then x::(foo2 func value xs)
  11.             else foo2 func value xs
  12.  
  13.         else if func = "gt" then
  14.             if x < value then x::(foo2 func value xs)
  15.             else foo2 func value xs
  16.  
  17.         else failwith "Invalid argument"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement