Awesome! Thanks so much!
Anthony
On Sep 7, 2:10 am, Meikel Brandmeyer wrote:
> Hi,
>
> first of all we should start with the form we finally want to have:
>
> (defrecord Foo [a b c])
>
> (defn make-Foo
> [& {:keys [a b c] :or {a :x c :z}}]
> (Foo. a b c))
>
> ; Use as: (make-Foo :b :f) => (
Hi,
first of all we should start with the form we finally want to have:
(defrecord Foo [a b c])
(defn make-Foo
[& {:keys [a b c] :or {a :x c :z}}]
(Foo. a b c))
; Use as: (make-Foo :b :f) => (Foo. :x :f :z)
The only annoying part is the boilerplate of defining make-Foo.
What we would like
Disclamer: I'm a Clojure noob, so bad code follows...
I have been putzing around with implementing a Simple Temporal Network
(a graph structure for scheduling problems) in Clojure. In the
process, I wanted to generate records that had default values.
I ran into this blog post by cemerick (http://c