README.md

[![Package Version](https://img.shields.io/hexpm/v/cnocco)](https://hex.pm/packages/cnocco)
[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/cnocco/)

# Cnocco

Cnocco is a library for computing a possible canoncial cover for a set of functional dependencies.

This is a for-fun project made for the sole purpose of playing with the canoncial cover algorithm introduced at university.
I don't plan on maintaining this project.

Only canonical covers of `Int`s can be generated, so if you have functional dependencies of other type, you need to parse these into `Int`s before you can use this library.

_Named after "Can(onical) Co(ver) kind of sounds like Cnocco... let's go with that."_

```sh
gleam add cnocco
```

```gleam
import gleam/io
import gleam/list
import gleam/string

import cnocco/cover
import cnocco/dependency

pub fn main() -> Nil {
  let assert Ok(deps) =
    cover.from_lists([
      #([1, 2], [3]),
      #([5, 9, 21], [23]),
      #([1, 2, 3, 4, 5], [10]),
      #([18, 20, 22], [25]),
    ])

  deps
  |> cover.from_dependencies()
  |> list.map(dependency.to_string)
  |> string.join("\n")
  |> io.println()

  // Output:
  // {1, 2, 4, 5} -> {10}
  // {18, 20, 22} -> {25}
  // {5, 9, 21} -> {23}
  // {1, 2} -> {3}
}
```

## Development

```sh
gleam run   # Run the project
gleam test  # Run the tests
```