Open danielytics opened 10 years ago
@danielytics well, @cesarbp is the expert, but if I had to guess, it's just another protobuf entity.
@bitemyapp it doesn't seem to be. I've checked the spec and there isn't an entity for it. The javascript and python drivers implement it in terms of FUNCALL
. As far as I can see, revise already implements all of the protobuf entities.
Is compile-term
essentially expr
?
parse-val
is the equivalent of expr
iirc. But unlike the other drivers it is not needed because it is already implicit when parsing the arguments to a revise.query fn.
Actually nevermind. func-wrap
appears to be the way the drivers use to turn an actual lambda into a rethinkdb lambda. This is much easier than I thought initially. The hard part is a decent name :-P.
Something like this might even work:
(defn placeholder
[& args-and-fn]
(let [f (last args-and-fn)
args (butlast args-and-fn)]
(apply funcall f args))
Brilliant, that works! :+1:
I personally would call it something similar or related to do
because it will make reading the RethinkDB docs and example code easier, but obviously that clashes with Clojure's do
. Perhaps something along the lines of with
?
EDIT: Moved question to #13
@danielytics You can probably just open another issue.
Enlive has a similar function which it calls do->
- maybe that's a reasonable name for this? Though do->
threads the result, while this doesn't. Maybe do-let
or doto
? I also still quite like with
.
http://www.rethinkdb.com/api/javascript/#do
I have looked at how the javascript and python drivers implement
do
and they implement it with funcall, however, I can't figure out how to actually usefuncall
from revise.