You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2016/10/31 19:25:58 UTC

[jira] [Commented] (TINKERPOP-1508) Add choose(predicate,trueTraversal)

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

ASF GitHub Bot commented on TINKERPOP-1508:
-------------------------------------------

GitHub user okram opened a pull request:

    https://github.com/apache/tinkerpop/pull/472

    TINKERPOP-1508: Add choose(predicate,trueTraversal)

    https://issues.apache.org/jira/browse/TINKERPOP-1508
    
    Added `GraphTraversal.choose(predicate,traversal)` and `GraphTraversal.choose(traversal,traversal)`. These are implemented as `choose(traversal,identity())`. Up to this point, `choose()` has been if/then/else-semantics and now with addition, we have if/then-semantics.
    
    VOTE +1

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/apache/tinkerpop TINKERPOP-1508

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/tinkerpop/pull/472.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #472
    
----
commit 659865bdb1a5e2db9e01847eb641101cab3d090a
Author: Marko A. Rodriguez <ok...@gmail.com>
Date:   2016-10-31T19:23:42Z

    added choose(predicate,traversal) which is a map to choose(predicate,traversal,identity()) and gives us if/then-semantics instead of always requiring if/then/else-semantics.

----


> Add choose(predicate,trueTraversal)
> -----------------------------------
>
>                 Key: TINKERPOP-1508
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-1508
>             Project: TinkerPop
>          Issue Type: Improvement
>          Components: process
>    Affects Versions: 3.2.2
>            Reporter: Marko A. Rodriguez
>
> {{choose()}} supports {{choose(predicateTraversal,trueTraversal,falseTraversal)}}.
> I have lots of code that does this:
> {code}
> choose(blah(), bloop(), identity())
> {code}
> That is, if the predicate traversal doesn't hold, I simply want the incoming traverser to be emitted -- {{identity()}}. This is sort of like {{optional()}}, but the predicate is something different from the branch. It would be nice to be able to simply say:
> {code}
> choose(blah(),bloop())
> {code}
> ...where its understood that a "false" means {{identity()}}.



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