# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.5.0] - 2024-09-17

### Added

- `BitString` is now included in the `Guesswork.Ast.Term` implementations.
- `Guesswork.Ast.And` and `Guesswork.Ast.Or` now check their arguments for
  `Guesswork.Ast.Fact` that are repeated with the same arguments and condense
  and pre-computes them using `Guesswork.Ast.Precomputed`.
  This ensures that work isn't overly repeated.
- Added a shift scheduling example.
- Added a Makefile for common targets.
- Added query benchmarks with tracked results.
- Telemetry now tracks precomputed streams.

### Fixed

- `Guesswork.Answer.Result` now keeps the underlying data as a
  `Guesswork.Answer.Binding.value()`, and only transforms it into a string when
  building the `Kino` render.
- When rules are extracted and their answer sets calculated, variables that fall
  out of scope are removed.
  This should stop the bug where internal variables shared between reused rules
  would conflict and disqualify valid answer sets.
  This has also allowed the removal of variable ids.
- `StreamSplit.take_and_drop/2` is now used to partially evaluate streams instead
  of `Enum.take/2` and `Stream.drop/2`.
  This will ensure that the old values are actually removed from streams instead
  of lazy operations building up.

## [0.4.4] - 2024-09-08

### Added

- CI jobs now run a dry run release to check for problems.

### Fixed

- Fixed examples to not include unused functions.

## [0.4.3] - 2024-09-07

### Fixed

- Fixed the file list in mix.exs to not include non-existent files.

## [0.4.2] - 2024-09-07

### Fixed

- Include dependency cache in release job so that publish works.

## [0.4.1] - 2024-09-07

### Fixed

- Fixed CI bug where hex wasn't pulled and so releases didn't make it to hex.pm.

## [0.4.0] - 2024-09-07

### Added

- `Ast.term/1` now supports the pin operator for pulling in external values and
  elixir expressions.
- Added `ExDoc` support.
- Telemetry has been added to the library:
  - A new module `Guesswork.Telemetry` holds a GenServer that tracks spans and
    metrics.
  - Queries now have their own struct that allow tracking of queries by id.
  - `Guesswork.Answer.Result.run/2` now reports a span that allows queries to be
    tracked and timed.
  - All assignments, substitutions, and tests are tracked (per query).
  - Unions are now tracked in spans.
  - A new example has been added to walk through this system.
- Simple benchmarks have been added to support telemetry operations.
- This project should now release to hex.pm and build a gitlab release on every
  merge to master.

### Fix

- Fixed bug where tests continued to be processed even after one failed.

## [0.3.0] - 2024-07-23

### Added

- `Ast.term/1` accepts entities other than atoms.
- Added support for a `one_of` operator that assigns a stream to a variable.
- Added support for an `is` operator that assigns computation.
- Falsehoods can now be added to collections.
- Added support for a `set` operator that assigns a value to a variable.
- Added a new, default, empty collection the `query/2` defaults to.
- `Result.new/2` has been renamed to `Result.run/2` for consistency with `Stream`.
- `Fact` now evaluates rules lazily in case there is a loop.
- New, high level tests have been added to verify the entire system.
- Added an example for pythagorean triples.

### Fixed

- Nots are now properly respected such that `l_not(l_and(set(x, 1), set(x, 2)))` is
  valid.
- Ands now evaluate their clauses such that infinite streams of answer sets can be
  properly evaluated.
- The macros used to define rules and terms now take functions instead of un-exported
  terms.

## [0.2.0] - 2024-06-27

### Added

- Added Credo linter.
- Added Dialyzer static analysis.
- Added a ci pipeline for MR quality control.
- Added a top level function for running queries.
- Added the classic family tree example.
- Added a `term/1` macro to make the process of making terms easier.
- Added implementations of `String.Chars` for all terms that mirrors the syntax
  of `term/1`.
- Knowledge bases have been generalized to use a behavior, which is taken advantage
  of with the new `Guesswork.KnowledgeBase.Collection` which makes it easy to create
  static collections of rules and facts.
- Add LICENSE.
- Added a new `Guesswork.Answer.Result` module that makes it easier to evaluate and
  display values on livebook.

### Fixed

- When facts are resolved they now search both for matching facts and matching
  rules.
- Variables now create an internal id that is used for comparison within answer
  sets so that separate variables with the same display name don't conflict.
- Fixed a bug in `And` where any repeating variable was seen as a conflict.
- `Statement.resolve/2` and `Guesswork.query/2` both return streams so that large
  problem spaces don't create issues.

## [0.1.0] - 2024-06-19

- init
