[
https://issues.apache.org/jira/browse/TINKERPOP3-760?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14650401#comment-14650401
]
Matt Frantz commented on TINKERPOP3-760:
----------------------------------------
What if {{Traverser.loops()}} returns a {{Path}}? It could be separately
maintained from the real path. The objects would be {{int\[1]}} containing the
loop variable so that the loop variable could be incremented without modifying
the {{Path}}. We use {{ImmutablePath}} so that each nesting loop can still
refer to outer loops without copying.
We could then refer to the loops by relative nesting depth or via label (on the
repeat step).
{noformat}
repeat(
repeat(
...loops() // innermost
...loops(0) // innermost
...loops(1) // next-innermost
...loops('i') // innermost
...loops('j') // next-innermost
).as('i')
).as('j')
{noformat}
> Make loop counter accessible within repeat()
> --------------------------------------------
>
> Key: TINKERPOP3-760
> URL: https://issues.apache.org/jira/browse/TINKERPOP3-760
> Project: TinkerPop 3
> Issue Type: Improvement
> Components: process
> Affects Versions: 3.0.0-incubating
> Reporter: Daniel Kuppitz
> Assignee: Daniel Kuppitz
> Fix For: 3.1.0-incubating
>
>
> Currently we can access the loop counter in a lambda:
> {code}
> .filter {it.loops() < 3}
> {code}
> Would be nice to have a step to access the counter:
> {code}
> .where(loops().is(lt(3)))
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)