Current section

Files

Jump to
colonel CHANGELOG.md
Raw

CHANGELOG.md

# Changelog
## 0.2.0 (2024-06-15)
### Iodata conveniences
[Iodata and chardata](https://hexdocs.pm/elixir/io-and-the-file-system.html#iodata-and-chardata) can be cheaper than strings to build, but they're often not as nice to work with. `Colonel` now provides two conveniences for working with iodata and chardata:
- `Colonel.Experimental.iodata_inspect/2` does what `Kernel.inspect/2` does but returns the result as iodata instead of building one string from it.
- `Colonel.Experimental.sigil_i/2` provides an `~i` sigil for building iodata or chardata with a string interpolation syntax.
## 0.1.0 (2024-05-02)
### Named Aliases for Operators
Operators look great inline, but there some cases where named functions work better:
- When piping function calls with `|>`, operators can be a bit strange. You either have to pipe into an anonymous function using the operator, or you have to use the fully-qualified name like `|> Kernel.+(1)`.
- When creating anonymous functions with the `&` syntax, you can wrap named functions without additional parentheses.
Colonel 0.1.0 introduces to `Colonel.Experimental` a number of aliases for common operators:
`Colonel.Experimental` Function | Operator
------------------------------------- | --------
`add(left, right)` | `left + right`
`and?(left, right)` | `left && right`
`binary_concat(left, right)` | `left <> right`
`divide(left, right)` | `left / right`
`equal?(left, right)` | `left == right`
`greater_than?(left, right)` | `left > right`
`greater_than_or_equal?(left, right)` | `left >= right`
`inequal?(left, right)` | `left != right`
`less_than?(left, right)` | `left < right`
`less_than_or_equal?(left, right)` | `left <= right`
`list_concat(left, right)` | `left ++ right`
`list_subtract(left, right)` | `left -- right`
`multiply(left, right)` | `left * right`
`negative(value)` | `-value`
`not?(value)` | `!value`
`or?(left, right)` | `left \|\| right`
`positive(value)` | `+value`
`strictly_equal?(left, right)` | `left === right`
`strictly_inequal?(left, right)` | `left !== right`
`subtract(left, right)` | `left - right`
### Recursive Anonymous Functions
Anonymous functions can't reference themselves without taking a function as an argument and being called with it. `Colonel.Experimental.recursive/1` takes care of that boilerplate to make recursive anonymous functions.