jepsen-io / elle

Black-box transactional safety checker based on cycle detection
Eclipse Public License 2.0
644 stars 34 forks source link

Is there any example on how to use the gen function? #23

Closed photoszzt closed 1 year ago

photoszzt commented 1 year ago

First of all, I'm not a closure programmer. So it might be a very dump question.

(ns jepsen.test
  (:require [elle.list-append :as a]
            [elle.txn :as ct]
            [jepsen.history :as h]
            [clojure.pprint :refer [pprint]]))
(defn -main
    (pprint (take 100 (ct/wr-txns {:key-count 3}))))

I'm trying to print out some txn history so that I can use the sequence to check my work. But it doesn't compile. lein run gives me this error:

Syntax error macroexpanding clojure.core/defn at (jepsen/test.clj:11:1).
pprint - failed: vector? at: [:fn-tail :arity-n :bodies :params] spec: :clojure.core.specs.alpha/param-list
(pprint (take 100 (ct/wr-txns {:key-count 3}))) - failed: vector? at: [:fn-tail :arity-1 :params] spec: :clojure.core.specs.alpha/param-list

I don't know what the error messages mean.

aphyr commented 1 year ago

Clojure expects functions like defn to take a vector of arguments. Your -main has no argument list. :-)

photoszzt commented 1 year ago

Thanks. I added an arg and it's working now.