%% %CopyrightBegin%
%%
%% SPDX-License-Identifier: Apache-2.0
%%
%% Copyright Ericsson AB 2021-2025. All Rights Reserved.
%%
%% %CopyrightEnd%

[;1m  relation(Tuples)[0m

  Equivalent to [;;4mrelation(Tuples, Type)[0m, where [;;4mType[0m is the size
  of the first tuple of [;;4mTuples[0m, if such a tuple exists.

  If tuples is [;;4m[][0m, then [;;4mType[0m is [;;4m2[0m.

[;1mExamples[0m

    1> S1 = sofs:relation([{1,a},{1,b},{1,a}]).
    2> sofs:to_external(S1).
    [{1,a},{1,b}]
    3> sofs:type(S1).
    [{atom,atom}]
    4> sofs:type(sofs:relation([])).
    [{atom,atom}]
    5> sofs:type(sofs:relation([], 3)).
    [{atom,atom,atom}]
    6> sofs:relation([a,b,c]).
    ** exception error: bad argument
         in function  sofs:relation/1

[;1m  relation(Tuples, Type)[0m

  Creates a relation.

  [;;4mrelation(R, T)[0m is equivalent to [;;4mfrom_term(R, T)[0m, if T is a type
  and the result is a relation.

  If [;;4mType[0m is an integer N, then [;;4m[{atom, ..., atom}])[0m, where the
  tuple size is N, is used as type of the relation.

[;1mExamples[0m

    1> S1 = sofs:relation([{3,blue},{2,green},{3,blue},{1,red}], [{index,color}]).
    2> sofs:to_external(S1).
    [{1,red},{2,green},{3,blue}]
    3> sofs:type(S1).
    [{index,color}]
    4> sofs:type(sofs:relation([{1,a},{1,b}], 2)).
    [{atom,atom}]
    5> sofs:type(sofs:relation([], 3)).
    [{atom,atom,atom}]
