lein new caching
然后我进入并像这样编辑我的 project.clj 文件。
(defproject caching "1.0.0-SNAPSHOT"
:description "FIXME: write description"
:dependencies [[org.clojure/clojure "1.3.0"]
[org.clojure/core.cache "0.5.0"]]
:plugins [[lein-swank "1.4.3"]])
我执行:
lein repl
依赖关系被拉出来,一切都很好。
然后,受https://github.com/clojure/core.cache/wiki/LRU上的示例文档的启发,我使用以下内容编辑 core.clj
(ns caching.core
(:require [clojure.core.cache :as cache]))
(cache/lru-cache-factory {} :limit 2)
并在编译 core.clj 时返回以下错误。所以......我做错了什么?有没有人让它正常工作?
Wrong number of args (3) passed to: cache$lru-cache-factory
[Thrown class clojure.lang.ArityException]
Restarts:
0: [QUIT] Quit to the SLIME top level
Backtrace:
0: AFn.java:437 clojure.lang.AFn.throwArity
1: AFn.java:47 clojure.lang.AFn.invoke
2: NO_SOURCE_FILE:1 caching.core/eval2247
3: Compiler.java:6465 clojure.lang.Compiler.eval
4: Compiler.java:6431 clojure.lang.Compiler.eval
5: core.clj:2795 clojure.core/eval
6: core.clj:532 swank.core/eval782[fn]
7: MultiFn.java:163 clojure.lang.MultiFn.invoke
8: basic.clj:54 swank.commands.basic/eval-region
9: basic.clj:44 swank.commands.basic/eval-region
10: basic.clj:73 swank.commands.basic/eval968[fn]
11: Var.java:401 clojure.lang.Var.invoke
12: (Unknown Source) caching.core/eval2245
13: Compiler.java:6465 clojure.lang.Compiler.eval
14: Compiler.java:6431 clojure.lang.Compiler.eval
15: core.clj:2795 clojure.core/eval
16: core.clj:100 swank.core/eval-in-emacs-package
17: core.clj:256 swank.core/eval-for-emacs
18: Var.java:409 clojure.lang.Var.invoke
19: AFn.java:167 clojure.lang.AFn.applyToHelper
20: Var.java:518 clojure.lang.Var.applyTo
21: core.clj:600 clojure.core/apply
22: core.clj:107 swank.core/eval-from-control
23: core.clj:330 swank.core/spawn-worker-thread[fn]
24: AFn.java:159 clojure.lang.AFn.applyToHelper
25: AFn.java:151 clojure.lang.AFn.applyTo
26: core.clj:600 clojure.core/apply
27: core.clj:326 swank.core/spawn-worker-thread[fn]
28: RestFn.java:397 clojure.lang.RestFn.invoke
29: AFn.java:24 clojure.lang.AFn.run
30: Thread.java:662 java.lang.Thread.run