# example 1
s = sleigh()
eachWorker(s, function() {x<<-1})
# eachElem can use global variable x initialized by eachWorker.
eachElem(s, function(y) {x+y}, list(1:10))
# example 2
options = list(blocking=0)
sp = eachWorker(s, function(z) {Sys.sleep(100)}, eo=options)
checkSleigh(sp)
waitSleigh(sp)
# example 3
# pass in fixed arguments to eachWorker
eachWorker(s, function(x, y) {x+y}, 10, 5)Run the code above in your browser using DataLab