我无法理解为什么以下函数适用于2个参数,即使我们用一个参数声明它:
let rec removeFromList e = function
h :: t -> if h=e then h
else h :: removeFromList e t
| _ -> [];;
removeFromList 1 [1;2;3];;
答案 0 :(得分:4)
你用两个参数声明它。语法:
let f x = match x with
可以看作是
的捷径let rec removeFromList e lst = match lst with
h :: t -> if h=e then h else h :: removeFromList e
所以,你的定义实际上是:
guard let toViewController: UIViewController = transitionContext.viewControllerForKey(UITransitionContextToViewControllerKey) else { return }
let toFrame = transitionContext.finalFrameForViewController(toViewController)