Added `partition` and `partition_all`

Also changed generated type of `partitionby` to tuple.

See #40