Current section
Files
Jump to
Current section
Files
src/given@internal@lib@optionx.erl
-module(given@internal@lib@optionx).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-export([partition/1]).
-file("/Volumes/Gleam/gleam-given/src/given/internal/lib/optionx.gleam", 25).
-spec partition_loop(list(gleam@option:option(FCS)), list(FCS), integer()) -> {list(FCS),
integer()}.
partition_loop(Options, Somes, None_count) ->
{Somes@1, Nones_count} = case Options of
[] ->
{Somes, None_count};
[{some, A} | Rest] ->
partition_loop(Rest, [A | Somes], None_count);
[none | Rest@1] ->
partition_loop(Rest@1, Somes, None_count + 1)
end,
{begin
_pipe = Somes@1,
lists:reverse(_pipe)
end,
Nones_count}.
-file("/Volumes/Gleam/gleam-given/src/given/internal/lib/optionx.gleam", 21).
-spec partition(list(gleam@option:option(FCO))) -> {list(FCO), integer()}.
partition(Options) ->
partition_loop(Options, [], 0).