-
Notifications
You must be signed in to change notification settings - Fork 11
quickref
Jonathan Claggett edited this page Apr 10, 2015
·
4 revisions
These macros aid in control flow in some way and do not change change the threaded topic.
(->/do t form*)
(->/if t then-form else-form)
(->/if-let t [bind-pair] then-form else-form)
(->/cond t test1 form1, test2 form2, ...)
(->/when t expr form*)
(->/when-let t [binding] form*)
(->/when-not t expr form*)
(->/let t [bind-pairs*] form*)
(->/for t [bind-pairs*] form*)These macros make it convenient to update a part of the overall topic by threading just that part through their body.
(->/update t key1 form1, key2 form2, ...)
(->/in t [path] form*)
(->/first t form*)
(->/second t form*)
(->/nth t form*)
(->/last t form*)
(->/take t form*)
(->/drop t form*)
(->/butlast t form*)
(->/rest t form*)
(->/each t form*)
(->/each-as t binding form*)These macros and functions are to it convenient to define and debug threaded forms.
(->/reset t value) ; replace t with value
(->/apply t f arg*)
(->/aside t form*)
(->/as t binding form*)
(->/fn [] form*)It is possible to refer to the current value of the threaded topic by
any form in the above macros by using the variable: <>. In addition,
two special binding macros are available inside any synthread macros
with a binding area. These are useful for doing two things with the
current topic: updating it and binding value of the topic either after
the update or before it.
(->/upget key updating-form getting-form)
(->/getup key getting-form updating-form)