-module(cosmo_cli@list_wrapper). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]). -export([replace_by/3]). -file("src/cosmo_cli/list_wrapper.gleam", 1). -spec replace_by(list(EWL), fun((EWL) -> boolean()), EWL) -> list(EWL). replace_by(List, Find_fn, Value) -> case List of [] -> []; [Head | Tail] -> case Find_fn(Head) of true -> [Value | replace_by(Tail, Find_fn, Value)]; false -> [Head | replace_by(Tail, Find_fn, Value)] end end.