-module(blah@utils). -compile(no_auto_import). -export([get_random_item/1, join/2]). -spec get_random_item(list(EJJ)) -> {ok, EJJ} | {error, nil}. get_random_item(Given_list) -> Max_index = begin _pipe = Given_list, gleam@list:length(_pipe) end, Index = gleam@int:random(0, Max_index), _pipe@1 = Given_list, gleam@list:at(_pipe@1, Index). -spec join(list(binary()), binary()) -> binary(). join(Parts, Separator) -> case begin _pipe = Parts, gleam@list:rest(_pipe) end of {ok, Rest} -> {ok, First@1} = case begin _pipe@1 = Parts, gleam@list:first(_pipe@1) end of {ok, First} -> {ok, First}; _try -> erlang:error(#{gleam_error => assert, message => <<"Assertion pattern match failed"/utf8>>, value => _try, module => <<"blah/utils"/utf8>>, function => <<"join"/utf8>>, line => 22}) end, Builder = begin _pipe@2 = Rest, gleam@list:fold( _pipe@2, begin _pipe@3 = First@1, gleam@string_builder:from_string(_pipe@3) end, fun(State, Current) -> _pipe@4 = State, _pipe@5 = gleam@string_builder:append( _pipe@4, Separator ), gleam@string_builder:append(_pipe@5, Current) end ) end, _pipe@6 = Builder, gleam@string_builder:to_string(_pipe@6); {error, nil} -> <<""/utf8>> end.