You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by "Marko A. Rodriguez (JIRA)" <ji...@apache.org> on 2015/10/01 17:32:27 UTC

[jira] [Commented] (TINKERPOP3-761) Some basic mathematical functions / steps

    [ https://issues.apache.org/jira/browse/TINKERPOP3-761?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14939972#comment-14939972 ] 

Marko A. Rodriguez commented on TINKERPOP3-761:
-----------------------------------------------

I want to knock this out for TP 3.1.0. Here is new proposal.

{code}
op(BinaryOperator<A>, Traversal<?,A>)
op(BinaryOperator<A>, Traversal<?,A>, Traversal<?,A>)
{code}

The underlying instruction would be {{BinaryOperatorStep<S,E>}}, where the provided {{BinaryOperator}} is {{BinaryOperator<E>}}. This is the foundation and is analogous to [~mhfrantz]'s {{curry()}}. However, we can't leave it at that level. We need to extend this explicit steps in {{GraphTraversal}}:

* {{sum : Number}}
* {{mult : Number}}
* {{div : Number}}
* {{concat : String}}
* ... ?

{code}
as('a')....values('age').sum(select('a'))
as('a')....as('b')...sum(select('a'),select('b'))
{code}

Note that {{sum()}} is a {{ReducingBarrierStep}} (and thus, {{fold(sum)}}) which is different. It takes not arguments and simply folds on a seed.

Thoughts?

> Some basic mathematical functions / steps
> -----------------------------------------
>
>                 Key: TINKERPOP3-761
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP3-761
>             Project: TinkerPop 3
>          Issue Type: Improvement
>          Components: process
>    Affects Versions: 3.0.1-incubating
>            Reporter: Daniel Kuppitz
>            Assignee: Marko A. Rodriguez
>
> Every once in a while I wish to have steps for some basic mathematical operations ({{add()}}, {{sub()}}, {{mul()}}, {{div()}}). Since {{sub(num)}} is the same as {{add(-num)}} and {{div(num)}} is the same as {{mul(1/num)}}, we would only need two new step implementations.
> Oh, and then there's also {{mod()}}, thus 3 new step implementations.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)