[SPARK-1241] Add sliding to RDD

Sliding is useful for operations like creating n-grams, calculating total variation, numerical integration, etc. This is similar to https://github.com/apache/incubator-spark/pull/18, but implemented differently.

JIRA:
https://spark-project.atlassian.net/browse/SPARK-1241