【发布时间】:2015-08-15 17:05:54
【问题描述】:
我要做的就是在创建 clojure defrecord 时为其创建一个自动生成的 UUID。我尝试了以下方法:
(ns myns
(:require [clj-uuid :as uuid])
(defrecord Thing [thing-id name])
(defn create-thing
[name]
(map->Thing {:thing-id (uuid/v1)
:name name}))
接着是:
(repeat 5 (create-thing "bob"))
但是我为我创建的每个Thing 创建了相同 UUID。帮助将不胜感激!
【问题讨论】: