Changes between Version 69 and Version 70 of Clojure Client Tutorial
- Timestamp:
- Aug 23, 2011 12:46:18 PM (13 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Clojure Client Tutorial
v69 v70 87 87 == Client Usage Tutorial == 88 88 89 === Summary===89 === Introduction === 90 90 The client has several ways of writing messages to the server, each of which has different behaviour with respect to synchronization and reply processing. The user must specify the way these functions operate by passing them data structures and functions which will be called on the data returned from the server. This is analogous to the "reduce" or "foldl" functions found in Clojure and Scheme respectively. If you are unfamiliar with using functions as arguments, then it may be worthwhile to experiment with in the REPL with either "map" or "reduce". For example, 91 92 {{{ 93 user=> (map inc [1 2 3 4 5]) 94 (2 3 4 5 6) 95 user=> (map (fn [e] (* e 2)) [1 2 3 4 5]) ; an anonymous function 96 (2 4 6 8 10) 97 user=> (map #(* % 2) [1 2 3 4 5]) ; same, but with alternative syntax 98 (2 4 6 8 10) 99 user=> ((juxt inc dec) 1) 100 [2 0] 101 }}} 102 103 The client behaviour more closely corresponds to the "reduce" function. 104 105 {{{ 106 user=> (reduce + [1 2 3 4 5]) 107 15 108 }}} 91 109 92 110 === Basic Functionality === … … 114 132 }}} 115 133 116 For example :134 For example, 117 135 118 136 {{{