### Title: Functional programming methods for List objects
### Aliases: funprog-methods Reduce,List-method Filter,List-method

pos2 <- Position(is.unsorted, x, right=TRUE)

### Aliases: class:GappedRanges GappedRanges-class GappedRanges
## The 3 following IRanges objects are normal. Each of them will be
## stored as a "gapped range" in the GappedRanges object 'gr'.

start(as(gr, "RangesList"))  # not the same as 'start(gr)'

### Aliases: class:Grouping Grouping-class Grouping nobj grouplength
###   grouplength,Grouping-method members members,Grouping-method vmembers
###   vmembers,Grouping-method togroup togroup,ANY-method tofactor
###   class:H2LGrouping H2LGrouping-class H2LGrouping high2low
###   Dups-class Dups duplicated,Dups-method duplicated.Dups
###   show,Dups-method class:Partitioning Partitioning-class Partitioning
# same as 'length(h2l)' for H2LGrouping objects
# all the members are put together and sorted
# same as 'grouplength(h2l, togroup(h2l))'
### The purpose of a Dups object is to describe the groups of duplicated
# same as 'unname(sapply(pbe1, length))' and 'width(pbe1)'
# same as 'grouplength(pbe1, togroup(pbe1))'
## D. RELATIONSHIP BETWEEN Partitioning OBJECTS AND successiveIRanges()
## The 3 following calls produce the same ranges:

showClass("Grouping")  # shows (some of) the known subclasses
nobj(h2l)  # same as 'length(h2l)' for H2LGrouping objects
grouplength(h2l)  # same as 'unname(sapply(h2l, length))'
members(h2l, 5:2)  # all the members are put together and sorted
togrouplength(h2l)  # same as 'grouplength(h2l, togroup(h2l))'
duplicated(dups1)  # same as 'duplicated(togroup(dups1))'
togrouplength(dups2)  # frequency for each element
pbe1 <- PartitioningByEnd(c(4, 7, 7, 8, 15), names=LETTERS[1:5])
grouplength(pbe1)  # same as 'unname(sapply(pbe1, length))' and 'width(pbe1)'
togrouplength(pbe1)  # same as 'grouplength(pbe1, togroup(pbe1))'
PartitioningByEnd(integer(9))  # all partitions are empty
ir <- successiveIRanges(mywidths)  # IRanges instance.
pbe <- PartitioningByEnd(cumsum(mywidths))  # PartitioningByEnd instance.
pbw <- PartitioningByWidth(mywidths)  # PartitioningByWidth instance.