outer               package:relations               R Documentation

_O_u_t_e_r _P_r_o_d_u_c_t _o_f _S_e_t_s (_T_u_p_l_e_s)

_D_e_s_c_r_i_p_t_i_o_n:

     Outer "product" of sets (tuples).

_U_s_a_g_e:

     set_outer(X, Y, FUN = "*", ..., SIMPLIFY = TRUE)
     tuple_outer(X, Y, FUN = "*", ..., SIMPLIFY = TRUE)

_A_r_g_u_m_e_n_t_s:

    X, Y: Set (tuple) objects or vectors. If 'Y' is omitted, 'X' will
          be used instead. In this case, 'FUN' can also be specified as
          'Y' for convenience.

     FUN: A function or function name (character string).

SIMPLIFY: Logical. If 'TRUE' and all return values of 'FUN' are atomic
          and of length 1, the result will be an atomic matrix;
          otherwise, a recursive one (a list with 'dim' attribute).

     ...: Additional arguments passed to the 'FUN'.

_D_e_t_a_i_l_s:

     This function applies 'FUN' to all pairs of elements specified in
     'X' and 'Y'.  Basically intended as a replacement for 'outer' for
     sets (tuples), it will also accept any vector for 'X' and 'Y'. 
     The return value will be a matrix of dimension 'length(X)' times
     'length(Y)', atomic or recursive depending on the complexity of
     'FUN''s return type and the 'SIMPLIFY' argument.

_S_e_e _A_l_s_o:

     'set', 'tuple', 'outer'.

_E_x_a_m_p_l_e_s:

     set_outer(set(1,2), set(1,2,3), "/")
     X <- set_outer(set(1,2), set(1,2,3), pair)
     X[[1,1]]
     Y <- set_outer(set(1,2), set(1,2,3), set)
     Y[[1,1]]
     set_outer(2 ^ set(1,2,3), set_is_subset)

     tuple_outer(pair(1,2), triple(1,2,3))
     tuple_outer(1:5, 1:4, "^")

