Skip to content

ORDERED_PAIR_LENGTH

Returns the length of the input OrderedPair. Params: default : OrderedPair The input OrderedPair to find the length of. Returns: out : Scalar The length of the input OrderedPair.
Python Code
from flojoy import flojoy, OrderedPair, Scalar


@flojoy
def ORDERED_PAIR_LENGTH(default: OrderedPair) -> Scalar:
    """Returns the length of the input OrderedPair.

    Parameters
    ----------
    default : OrderedPair
        The input OrderedPair to find the length of.

    Returns
    -------
    Scalar
        The length of the input OrderedPair.
    """

    return Scalar(c=len(default.x))

Find this Flojoy Block on GitHub

Example

Having problems with this example app? Join our Discord community and we will help you out!
React Flow mini map

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.