Fork me on GitHub

Hello, folks. How can I create blank record (with all fields nil) without compilation warnings? I have record (defrecord Post [id body created-at updated-at title description image reading-time]) Currently I do it by eval (->Post) without arguments, is it idiomatic way to do it? (It gives me warning message)

Drew Verlee01:07:34


(defrecord Foo [x])
(map->Foo {})

Drew Verlee01:07:29

gives ; ->#nfclojure.tic_tac.Foo{:x nil}

Drew Verlee01:07:40

@crashtown As an aside, hash-maps are more re-usable then records. My rule right now is that i should have a well defined reason before using records over hash-maps. Sense your asking in beginner i assume that insight might be new to you.


@drewverlee, thank you, I’ll think about hash-map suggestion 🙂