get() on a List

In Gremlin how does one do a get() on a List in order to access an item by index?
Solution:
Gremlin doesn't have get() but you can accomplish similar things with the range(), limit(), tail(), and skip(): ``` gremlin> g.inject([10,20,30,40,50]).limit(local,1) ==>10 gremlin> g.inject([10,20,30,40,50]).tail(local,1)...
Jump to solution
1 Reply
Solution
spmallette
spmallette2y ago
Gremlin doesn't have get() but you can accomplish similar things with the range(), limit(), tail(), and skip():
gremlin> g.inject([10,20,30,40,50]).limit(local,1)
==>10
gremlin> g.inject([10,20,30,40,50]).tail(local,1)
==>50
gremlin> g.inject([10,20,30,40,50]).range(local,2,3)
==>30
gremlin> g.inject([10,20,30,40,50]).limit(local,1)
==>10
gremlin> g.inject([10,20,30,40,50]).tail(local,1)
==>50
gremlin> g.inject([10,20,30,40,50]).range(local,2,3)
==>30
Want results from more Discord servers?
Add your server