func inner(list: [T]) -> [T] { let result: [T]; if let head = list.first { result = test(head) ? inner(Array(list.dropFirst())) : list } else { result = list; } return result; } return inner; } func lessThan5(i: Int) -> Bool { return i < 5; } let f = dropWhile(lessThan5) f([1,2,3,4,5,1,2,3]) f([1,1,2,3,5,8,13])