class ListOps { private static List empty() { return LinkedList.empty(); } public static List append(List l1,List l2) { if(l1.isempty()) return l2; else { List a=append(l1.tail(),l2); return a.cons(l1.head()); } } public static List merge(List l1,List l2) { if(l1.isempty()) return l2; else if(l2.isempty()) return l1; else { List m=merge(l1.tail(),l2.tail()); return m.cons(l2.head()).cons(l1.head()); } } public static List take(int n,List L) { if(n==0||L.isempty()) return empty(); else return take(n-1,L.tail()).cons(L.head()); } public static List drop(int n,List L) { if(n==0||L.isempty()) return L; else return drop(n-1,L.tail()); } }