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

[;1m  projection(SetFun, Set1)[0m

  Returns the set created by substituting each element of [;;4mSet1[0m by
  the result of applying [;;4mSetFun[0m to the element.

  If [;;4mSetFun[0m is a number i >= 1 and [;;4mSet1[0m is a relation, then the
  returned set is the projection of [;;4mSet1[0m onto coordinate i.

[;1mExamples[0m

    1> S1 = sofs:from_term([{1,a},{2,b},{3,a}]).
    2> S2 = sofs:projection(2, S1).
    3> sofs:to_external(S2).
    [a,b]

  Projecting using an external SetFun.

    1> S1 = sofs:relation([{1,2,7}, {4,3,2}]).
    2> SetFun = {external,fun({X,_,Z}) -> {X,Z} end}.
    3> S2 = sofs:projection(SetFun, S1).
    4> sofs:to_external(S2).
    [{1,7},{4,2}]
