User Defined Functions in Gremlin

425 views
Skip to first unread message

Marko A. Rodriguez

unread,
Jan 25, 2010, 4:38:38 PM1/25/10
to gremli...@googlegroups.com
Hello everyone,

Thanks to the efforts of Pavel, we now have the ability to define
functions in Gremlin. You can learn more about function definitions
here:

http://wiki.github.com/tinkerpop/gremlin/language-statements#function
http://wiki.github.com/tinkerpop/gremlin/user-defined-functions

In short, for those that'd don't like opening links:

gremlin> func ex:hello($name)
concat('hello ', $name)
end
gremlin> ex:hello('pavel')
==>hello pavel

There are still some open issues that we need to solve/finalize:

1. perhaps making functions part of the Gremlin type system and thus,
functions as first class citizens.
2. allowing users to override existing function definitions (e.g.
override g:append()) -- currently nothing happens if you try.
3. currently you can define functions within functions which can lead
to some odd behavior with name repeats as functions are not scoped.

If you play around with the new body of code and have thoughts on any
of these issues or other issues, please bring them forward.

Thanks Pavel for your work...
Marko.

http://markorodriguez.com
http://tinkerpop.com

Joshua Shinavier

unread,
Jan 25, 2010, 10:50:21 PM1/25/10
to gremli...@googlegroups.com
On Mon, Jan 25, 2010 at 4:38 PM, Marko A. Rodriguez
<okram...@gmail.com> wrote:
> Hello everyone,
>
> Thanks to the efforts of Pavel, we now have the ability to define functions
> in Gremlin. You can learn more about function definitions here:
[...]


Very nice.

> There are still some open issues that we need to solve/finalize:
>
> 1. perhaps making functions part of the Gremlin type system and thus,
> functions as first class citizens.


In that case, will you also support closures?

[...]


> Thanks Pavel for your work...
> Marko.

Josh

Pavel Yaskevich

unread,
Jan 26, 2010, 1:31:07 AM1/26/10
to gremli...@googlegroups.com
About Closures - Yes, I think in time we'll get to it.

2010/1/26 Joshua Shinavier <par...@gmail.com>

Pavel Yaskevich

unread,
Jan 26, 2010, 5:34:58 AM1/26/10
to gremli...@googlegroups.com
Hi Marko, 

I think with your last commits you broke functions support, last working commit for me - http://github.com/tinkerpop/gremlin/commit/1e511af323b5e5b5e0c29e7c2f7f46c89a4dc747

Regards, Pavel.

2010/1/26 Pavel Yaskevich <pov...@gmail.com>

Pavel Yaskevich

unread,
Jan 26, 2010, 5:51:06 AM1/26/10
to gremli...@googlegroups.com
Last totally correctly working commit is - http://github.com/tinkerpop/gremlin/commit/08beca171345379122bde09e90a6c80d59c4da18

2010/1/26 Pavel Yaskevich <pov...@gmail.com>
Reply all
Reply to author
Forward
0 new messages