Lavorando sul seguente esempio in "Clojure in azione":Errore con "applicare" la funzione in Clojure: "Non so come creare iseq da: java.lang.Long" (Pag. 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))
valutazione sulla REPL:
(with-line-item-conditions basic-item-total 20 1)
risultati nella seguente eccezione che sono gettati:
Don't know how to create ISeq from: java.lang.Long
[Thrown class java.lang.IllegalArgumentException]
sembra che l'eccezione viene th rown dopo aver valutato la procedura di applicazione.
'apply' è una funzione, non una macro. – amalloy