s/sfc/gsc/g

'
This commit is contained in:
2026-10-20 18:42:11 -07:00
parent 2e062bb8c9
commit 70a853ae99
27 changed files with 291 additions and 291 deletions
+55
View File
@@ -0,0 +1,55 @@
-module(sfc_ntree).
-export([
nstem/2, meta/1, kids/1,
flatten_tree/1, flatten_forest/1
]).
-include("$sfc_include/sfc.hrl").
%%=====================================================
%% API: functions
%%=====================================================
-spec nstem(Root, Forest) -> Tree when
Root :: S,
Forest :: nforest(S, L),
Tree :: ntree(S, L),
S :: any(),
L :: any().
nstem(Root, List) ->
{ns, Root, List}.
meta(#ns{meta = M}) -> M.
kids(#ns{kids = K}) -> K.
-spec flatten_tree(Tree) -> Leafs when
Tree :: ntree(_, L),
Leafs :: [L],
L :: any().
flatten_tree(T) ->
lists:flatten(ft(T)).
-spec flatten_forest(Forest) -> Leafs when
Forest :: nforest(_, L),
Leafs :: [L],
L :: any().
flatten_forest(F) ->
lists:flatten(ff(F)).
ft(#ns{kids = F}) -> ff(F);
ft(Leaf) -> [Leaf].
ff(F) ->
[ft(T) || T <- F].