Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an example that shows how to select all but the last item in a collection/stream #216

Open
krlawrence opened this issue Mar 17, 2021 · 0 comments

Comments

@krlawrence
Copy link
Owner

krlawrence commented Mar 17, 2021

There is no list separator type syntax in Gremlin. This is one way to achieve the [0:-2] type pattern.

gremlin> g.V(1,2,3,4).fold().sideEffect(tail(local).store('t')).unfold().where(neq('t')).by().by(unfold())
==>v[1]
==>v[2]
==>v[3]  

Also add an example that shows how to pick the penultimate value is a stream such as

gremlin> g.V(1,2,3,4).tail(2).limit(1)
==>v[3]     
@krlawrence krlawrence self-assigned this Mar 17, 2021
@krlawrence krlawrence added this to Needs triage in Planning via automation Mar 17, 2021
@krlawrence krlawrence moved this from Needs triage to Medium Priority in Planning Mar 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Planning
  
Medium Priority
Development

No branches or pull requests

1 participant