Stephen Mallette created TINKERPOP-3057:
-------------------------------------------

             Summary: Add collate() list step
                 Key: TINKERPOP-3057
                 URL: https://issues.apache.org/jira/browse/TINKERPOP-3057
             Project: TinkerPop
          Issue Type: Improvement
          Components: language
    Affects Versions: 3.7.1
            Reporter: Stephen Mallette


Something similar to groovy's {{collate()}} - could also be {{partition()}}:

{code}
def list = [ 1, 2, 3, 4, 5, 6, 7 ]
def coll = list.collate( 3 )
assert coll == [ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7 ] ]
{code}

the Gremlin pattern for this is complicated:

{code}
  emit().
  until(__.not(unfold())).
  repeat(skip(local,2)).
  filter(unfold()).
  limit(local,2).
{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to