This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

scala like collection interface for python iterable.

Project Description

scala collection like interface for python iterato.r

Iterable object:

>>> from scalalike.collections import Iterable
>>> it = Iterable(range(10))
>>> it
<scalalike.collections.collection.Iterable object at 0x9b0428c>
>>> it.to_list()
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> it.map(lambda x:x*2).to_list()
[0, 2, 4, 6, 8, 10, 12, 14, 16, 18]
>>> it.filter(lambda x:x%2 == 0).to_list()
[0, 2, 4, 6, 8]
>>> it.filter(lambda x:x%2 == 0).map(lambda x:x*2).to_list()
[0, 4, 8, 12, 16]
>>> it.flatmap(lambda x: [x, x]).to_list()
[0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9]
>>> it.take(4).to_list()
[0, 1, 2, 3]
>>> it.foldleft(lambda x, y: x+y)
45

Map object:

>>> from scalalike.collections import Iterable
>>> mp = Map(aa=10, bb=20)
>>> mp
{'aa': 10, 'bb': 20}
>>> mp.map(lambda (k, v): (k, v*2))
{'aa': 20, 'bb': 40}
>>> mp.filter(lambda (k, v): k == 'bb')
{'bb': 20}
Release History

Release History

This version
History Node

0.1.0

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
scalalike.collections-0.1.0.tar.gz (3.2 kB) Copy SHA256 Checksum SHA256 Source Jul 11, 2011

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting