# Load the papply package.  NOTE: You do not need to load Rmpi - papply
# tries this automatically.
library(papply)

# compute a list of sums over 1:i for 1 <= i <= 10.
args <- list()
for (i in 1:10) {
    args[[i]] <- 1:i
    }
papply(args,sum)

# compute a list of fake names for Ricky.  Express as a greeting.
# (This example is based off of a TV show reference).  Provides an 
# example of using the papply_commondata argument, and using a list
# as an argument.
env <- list(greeting="Hello")
names <- list()
names[[1]] <- list(first="Randy", last="Lahey")
names[[2]] <- list(first="Cory", last="Trevor")
greet <- function(arg) {
    return(paste(greeting, ' ', arg$first, ' ',arg$last))
    }
papply(names, greet, env)
