在“Clojure in Action”(第 63 页)中处理以下示例:
(defn basic-item-total [price quantity]
(* price quantity))
(defn with-line-item-conditions [f price quantity]
{:pre [(> price 0) (> quantity 0)]
:post [(> % 1)]}
(apply f price quantity))
评估 REPL:
(with-line-item-conditions basic-item-total 20 1)
导致引发以下异常:
Don't know how to create ISeq from: java.lang.Long
[Thrown class java.lang.IllegalArgumentException]
在评估应用程序之后似乎正在引发异常。