You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (JIRA)" <ji...@apache.org> on 2017/05/02 02:04:19 UTC
[jira] [Closed] (GROOVY-7479) Groovy should provide "inits" and
"tails" DGM methods for lists
[ https://issues.apache.org/jira/browse/GROOVY-7479?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul King closed GROOVY-7479.
-----------------------------
> 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: New Feature
> Components: groovy-jdk
> Reporter: Paul King
> Assignee: Paul King
> Fix For: 2.5.0-alpha-1
>
>
> 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.15#6346)