You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by "Matt Frantz (JIRA)" <ji...@apache.org> on 2015/05/08 05:15:00 UTC

[jira] [Created] (TINKERPOP3-673) limit(local, 1) should emit element, not List

Matt Frantz created TINKERPOP3-673:
--------------------------------------

             Summary: limit(local, 1) should emit element, not List
                 Key: TINKERPOP3-673
                 URL: https://issues.apache.org/jira/browse/TINKERPOP3-673
             Project: TinkerPop 3
          Issue Type: Improvement
          Components: process
            Reporter: Matt Frantz


The philosophy of the TP3 API is "containers only when necessary".  There is a tendency to eschew the container when its size would be one.

For example, {{select("foo")}} will not emit a {{Map}} with a single key/value, but instead will emit a single value.  Similarly, if any {{select}} of a step label finds only a single instance of that step in the path, it will emit the value at that step; only if multiple steps in the path have the same label will a {{List}} be created.

In that spirit, {{limit(local, 1)}} should emit an element, rather than a one-element {{List}}.

This would also mean that {{range(local)}} operating on a {{List}} would emit a single element if the number of elements is selected by the range is 1.

This would also reconcile the behavior with the {{tail}} step.




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