[ https://issues.apache.org/jira/browse/GROOVY-7479?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14605525#comment-14605525 ]
ASF GitHub Bot commented on GROOVY-7479: ---------------------------------------- GitHub user paulk-asert opened a pull request: https://github.com/apache/incubator-groovy/pull/48 GROOVY-7479: Groovy should provide "inits" and "tails" DGM methods fo… …r lists You can merge this pull request into a Git repository by running: $ git pull https://github.com/paulk-asert/incubator-groovy groovy7479 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/incubator-groovy/pull/48.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #48 ---- commit ef8ebc001198059df57ec7e77128baca6511a7c7 Author: Paul King <pa...@asert.com.au> Date: 2015-06-29T12:02:25Z GROOVY-7479: Groovy should provide "inits" and "tails" DGM methods for lists ---- > Groovy should provide "inits" and "tails" DGM methods for lists > --------------------------------------------------------------- > > Key: GROOVY-7479 > URL: https://issues.apache.org/jira/browse/GROOVY-7479 > Project: Groovy > Issue Type: Bug > Reporter: Paul King > > Similar behaviour to Scala: > http://www.scala-lang.org/api/2.10.3/index.html#scala.collection.immutable.List > The relevant bits: > {{inits}}: Iterates over the init values of this list: the first value will > be this list and the final one will be an empty list, with the intervening > values the results of successive applications of init. > {{tails}}: Iterates over the tail values of this list: the first value will > be this list and the final one will be an empty list, with the intervening > values the results of successive applications of tail. > Rather than Scala's Iterable, I think just returning a list will be fine to > match other methods like {{combinations}}. If efficiency is a concern we > could return views (subList) from perhaps a copy of the incoming items. -- This message was sent by Atlassian JIRA (v6.3.4#6332)