Changes between Version 21 and Version 22 of Clojure Client Tutorial


Ignore:
Timestamp:
Aug 4, 2011 3:13:09 PM (13 years ago)
Author:
kedwar10
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Clojure Client Tutorial

    v21 v22  
    161161client.protocol-one/send-and-get
    162162([quagent id msg] [quagent id msg f])
    163   Send a op to the server and block this thread until the op completes. Args are a (unique) op id, a msg to send to the server and a function f that determines how to combine the current reply from the server with past results (defaults to conj).
     163  Send a op to the server and block this thread until the
     164  op completes. Args are a (unique) op id, a msg to send
     165  to the server and a function f that determines how to
     166  combine the current reply from the server with past
     167  results (defaults to conj).
    164168nil
    165169}}}
     
    170174client.protocol-one/send-and-get-later
    171175([quagent id msg] [quagent id msg f])
    172   This will spawn a separate thread to do the send and get, if you try to dereference it before it has completed, it will block.  Use future-done? to check the status before dereferencing.
     176  This will spawn a separate thread to do the send and get,
     177  if you try to dereference it before it has completed,
     178  it will block.  Use future-done? to check the status before
     179  dereferencing.
    173180nil
    174181}}}
     
    179186client.protocol-one/send-and-watch
    180187([quagent id msg wf] [quagent id msg f wf])
    181   Sends the op to the server and then applies f to update the value.  When the value changes wf is called (wf must meet the requirements of the add-watch function).  The return value is the key for the watcher; this is used to delete it if necessary [(example)](http://clojure-examples.appspot.com/clojure.core/add-watch?revision=1278516003572).
     188  Sends the op to the server and then applies f to update the value.
     189  When the value changes wf is called (wf must meet the requirements
     190  of the add-watch function).  The return value is the key for the
     191  watcher; this is used to delete it if necessary
     192 [(example)](http://clojure-examples.appspot.com/clojure.core/add-watch?revision=1278516003572).
    182193nil
    183194}}}
     
    187198
    188199{{{
    189 client.core=> (defn get-location-of [quagent] (client->server send-and-get quagent :now :current-location nil))
     200client.core=> (defn get-location-of
     201                 [quagent]
     202                 (client->server send-and-get quagent :now :current-location nil))
    190203#'client.core/get-location-of
    191204}}}