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.
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