Fixes for 0MQ 2.0.7.
[cl-cluster.git] / meta.lisp
blob3308b9c718e4d28ad0eae012ffc63270b9ec5d60
1 (in-package :cl-cluster)
3 (defmacro with-remote (node &body body)
4 "Execute body at remote host."
5 `(node-exec ,node (format nil "~s" '(progn ,@body))))
7 (defmacro send-remote (node &body body)
8 "Execute body at remote host."
9 `(node-exec ,node (format nil "~s" '(progn ,@body)) nil nil nil))
11 (defmacro exec-remote (node &body body)
12 "Execute body at remote host."
13 `(node-exec ,node (format nil "~s" '(progn ,@body)) nil t t))
15 (defmacro rplet (node (&rest bindings) &body body)
16 "Let-like macro for remote lisp. Evaluate vars using pmap."
17 (let ((syms (mapcar (lambda (x)
18 (gensym (string (car x))))
19 bindings)))
20 `(node-exec ,node
21 ,(if (null syms) `(format nil "~s" '(progn ,@body))
22 `(format nil "(let ~s ~s)"
23 (let ,(loop for (nil exp) in bindings
24 for sym in syms
25 collect `(,sym (pexec ,exp)))
26 (list ,@(loop for (var nil) in bindings
27 for sym in syms
28 collect `(list ',var (yield ,sym)))))
29 '(progn ,@body))))))