I think the syntax should just be changed from concat(Traversal) to
concat(Traversal...) which would let you work around this issue by using
constant():

g.V(3).as('a').values('code').concat(constant(' is in '),
select('a').values('city'))

This would address the symmetry problem with concat(String...) without
having to open up concat(Object...) (at least not yet). I think format()
could be a neat step and there was an open issue for it at one point:

https://issues.apache.org/jira/browse/TINKERPOP-2334

i'd closed it once i saw that dave had suggested these lower level string
functions. i'd like to see the lower level functions added first and then
talk about bringing back to the format() idea.

On Tue, Aug 15, 2023 at 7:54 PM Valentyn Kahamlyk
<valent...@bitquilltech.com.invalid> wrote:

> Maybe for such situations it is more organic to add a new  `format` step?
> It will also be very useful in many other situations and be able to replace
> the asString step.
> ```
> g.V(3).format("%s is in %s", values("code", "city")))
> ```
>
> or other example for modern graph
> ```
> g.V().hasLabel("person").format("Person %s is %s years old", values("name",
> "age"))
> ```
>
> On Tue, Aug 15, 2023 at 8:24 AM Kelvin Lawrence <
> kelvin.r.lawre...@gmail.com>
> wrote:
>
> > Playing with Gremlin 3.7, and looking at concat() I kind of wish this
> > worked
> >
> > g.V(3).as('a').values('code').concat(' is in ',
> select('a').values('city'))
> >
> > rather than having to do
> >
> > g.V(3).as('a').values('code').concat(' is in
> > ').concat(select('a').values('city'))
> >
> > 2:58 <https://amzn-aws.slack.com/archives/D019DRT9KKN/p1691611095325259>
> > we do allow
> >
> > g.V(3).as('a').values('code').concat(' is in ', 'Austin')  //String...
> >
> > so it feels a little unbalanced. I wish I had noticed this before
> > but I guess the type signature would have to be object... almost for that
> > to work. Perhaps there is a possible compromise where we could do
> something
> > using Traversal... and String...
> >
> > --
> > Cheers, Kelvin
> >
>

Reply via email to