ORDERED_PAIR_INDEXING
Download Flojoy Studio to try this app
  
 Returns the value of the OrderedPair at the requested index.   Params:    default : OrderedPair  The input OrderedPair to index.   index : int  The index of the OrderedPair to return.   x_axis : bool  Index x axis? If not y is indexed.     Returns:    out : Scalar  The scalar index of the input OrderedPair.    
Python Code
from flojoy import flojoy, OrderedPair, Scalar
@flojoy
def ORDERED_PAIR_INDEXING(
    default: OrderedPair,
    index: int = 0,
    x_axis: bool = False,
) -> Scalar:
    """Returns the value of the OrderedPair at the requested index.
    Parameters
    ----------
    default : OrderedPair
        The input OrderedPair to index.
    index : int
        The index of the OrderedPair to return.
    x_axis : bool
        Index x axis? If not y is indexed.
    Returns
    -------
    Scalar
        The scalar index of the input OrderedPair.
    """
    assert (
        len(default.x) > index
    ), "The index parameter must be less than the length of the OrderedPair."
    assert index >= 0, "The index parameter must be greater than zero."
    if x_axis:
        c = default.x[index]
    else:
        c = default.y[index]
    return Scalar(c=c)
Example App
Having problems with this example app? Join our Discord community and we will help you out!
This app uses ordered pair transformation techniques.
First the necessary blocks were added:
- LINSPACE
- SINE
- ORDERED_PAIR_LENGTH
- ORDERED_PAIR_INDEXING
- ORDERED_PAIR_DELETE
- 2x BIG_NUMBER
- TABLE
LINSPACE and SINE created an ordered pair data type (x and y axis pairs). ORDERED_PAIR_LENGTH extracts the length of an ordered pair (this length is viewed with BIG_NUMBER here). ORDERED_PAIR_INDEXING extracts a single value from either the x or y axes (this value is viewed with BIG_NUMBER here). ORDERED_PAIR_DELETE deletes single indexes from both the x or y axes and outputs a new ordered pair (the new ordered pair is viewed with BIG_NUMBER here).
The blocks were connected as shown and the app was run.