You are calling iterate() after groupCount and that is causing that
error. Removing it and simply accessing m after the gremlin has
executed will allow you to get at the count.
If you explicitly want to return the value of the groupCount to the
next step, I guess you could define your step this way:
Gremlin.defineStep('fn', [Vertex, Pipe], { x ->
_().out(x).name.groupCount.cap})
and then do:
gremlin> g = TinkerGraphFactory.createTinkerGraph()
==>tinkergraph[vertices:6 edges:6]
gremlin> \. test.grm
==>null
gremlin> m = g.v(1).fn('created').next()
==>lop=1
gremlin> m
==>lop=1
Does that help?
Stephen
> --
>
>