Merge Two Lists in F# Recursively [duplicate]
问题 This question already has answers here : Merge two lists (5 answers) Closed 3 years ago . I am looking to write a recursive function to merge to integer lists in F# I started with this, but not sure what to do next. let rec merge xs ys = match xs with | [] -> ys | let li = [1;3;5;7;] let ll = [2;4;5;8;] 回答1: As I said in my comment, it's probably easiest if you pattern match on xs and ys simultaneously: let rec merge xs ys = match xs,ys with | [],l | l,[] -> l | x::xs', y::ys' -> if x < y