Utilities for formatting Strings.
import fmt
fn test_to_string(val) {
fmt.to_string(val) // Converts any value to String
}
fn test_append(a_list) {
case a_list {
[] -> "list is empty"
[x] -> "list has one element: " |> fmt.append(x) // Appends any value as a String
[x, y] -> "list has two elements: "
|> fmt.append(x)
|> fmt.append(" and ")
|> fmt.append(y)
_ -> "list has more than two elements"
}
}
# Build the project
rebar3 compile
# Run the eunit tests
rebar3 eunit
# Run the Erlang REPL
rebar3 shell
If available in Hex
this package can be installed by adding fmt
to your rebar.config
dependencies:
{deps, [
fmt
]}.