My guess is that what you're looking for is:
(def debug #(log "DEBUG" % :idVE "COM"))
(see "Anonymous function literal" under
http://clojure.org/reference/reader#_dispatch)
However, note that defining functions in a "point-free"-ish style in
Clojure has a downside with regard to metadata, in that the function
arities and argument names aren't inspectable at the REPL:
(def debug-1 #(log "DEBUG" % :idVE "COM"))
;= user/debug-1
(clojure.repl/doc debug-1)
; -------------------------
; user/debug-1
; nil
;= nil
(defn debug-2 [message]
(log "DEBUG" message :idVE "COM"))
;= user/debug-2
(clojure.repl/doc debug-2)
; -------------------------
; user/debug-2
; ([message])
; nil
;= nil
Hope that's helpful,
Josh
P.S. If you *really want to* you can populate the :arglists metadata
yourself:
(def ^{:arglists '([message])} debug #(log "DEBUG" % :idVE "COM"))
On Tuesday, February 23, 2016 at 1:14:33 PM UTC-5, Fernando Abrao wrote:
>
> Hello all,
>
> I´m trying to do something like:
>
> (defn log [type message & {:keys [id idVe] :or {id "LOCAL" idVe "END"}}]
> (println (str id ": " type " -> " message "<- " idVe)))
>
>
> (def debug (partial log "DEBUG" ?? :idVe "COM"))
>
>
> Is there any way to do what I want? Pass arguments to log and add the
> :idVe into the end? Is the partial the best using to do this?
>
> Regards,
>
> Fernando
>
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.