Hi,

On 24 Mrz., 16:16, Thorsten Wilms <t...@freenet.de> wrote:

> ----
> (defn save-article
>    [path form-params timestamp]
>    (ds/save! (Article. path (form-params "title") (form-params "body")
>       timestamp))))
> ----

The problem is the constructor call. With plain old clojure
functions you could use apply, but Java method and constructor
calls must be hard-wired in the bytecode (and hence at
compilation time) (if I understood this correctly).

So there will be now way around explicitly specifying the map
keys. Although you can relieve the pain a little with
destructuring as Tassilo already showed. It can be shorted a
bit using :strs.

(defn save-article
  [path {:strs [title body]} timestamp]
  (ds/save! (Article. path title body timestamp)))

Sincerely
Meikel

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to