I have a simple record definition, for example
(defrecord User [name email place])
What is the best way to make a record having it\'s value
Warning: works only for literal sequables! (see Mihał's comment)
Try this macro:
(defmacro instantiate [klass values]
`(new ~klass ~@values))
If you expand it with:
(macroexpand '(instantiate User ["John" "john@example.com" "Dreamland"]))
you'll get this:
(new User "John" "john@example.com" "Dreamland")
which is basically what you need.
And you can use it for instantiating other record types, or Java classes. Basically, this is just a class constructor that takes a one sequence of parameters instead of many parameters.