03
Sep
11

scala sliding



Here’s a cool little utility Scala provides. The sliding method, which allows you access to consecutive pairs of elements. Here’s an example of how it’s used:


scala> "Wordpress".sliding(3).foreach(println)
Wor
ord
rdp
dpr
pre
res
ess

Advertisements

0 Responses to “scala sliding”



  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Blog Stats

  • 229,426 hits

%d bloggers like this: