Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/giacomocavalieri/non_empty_list
✨ Non-empty lists in Gleam
https://github.com/giacomocavalieri/non_empty_list
data-structures
Last synced: about 2 months ago
JSON representation
✨ Non-empty lists in Gleam
- Host: GitHub
- URL: https://github.com/giacomocavalieri/non_empty_list
- Owner: giacomocavalieri
- License: apache-2.0
- Created: 2023-05-26T09:47:23.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-10T22:28:07.000Z (10 months ago)
- Last Synced: 2024-03-15T00:51:48.241Z (9 months ago)
- Topics: data-structures
- Language: Gleam
- Homepage: https://hexdocs.pm/non_empty_list/
- Size: 44.9 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-gleam - non_empty_list - [📚](https://hexdocs.pm/non_empty_list/) - Non-empty lists in Gleam (Packages / Data Structures)
README
# non_empty_list
[![Package Version](https://img.shields.io/hexpm/v/non_empty_list)](https://hex.pm/packages/non_empty_list)
[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/non_empty_list/)
![CI](https://github.com/giacomocavalieri/non_empty_list/workflows/CI/badge.svg?branch=main)✨ Non-empty lists in Gleam
> ⚙️ This package supports both the Erlang and JavaScript target!
## Installation
To add this package to your Gleam project:
```sh
gleam add non_empty_list
```## Usage
Import the `non_empty_list` module and write some code!
```gleam
import non_empty_list
import gleam/int
import gleam/iopub fn main() {
non_empty_list.new(1, [2, 3, 4])
|> non_empty_list.reduce(with: fn(n, m) { n + m })
|> int.to_string
|> io.println
}
```## Contributing
This package exposes most of the same functions you'd find in the `gleam/list`
module but it may be missing some useful functions.If you think there's a missing function that would fit here, or if you spot a
bug don't be afraid to open PRs, issues or requests of any kind!
Any contribution is welcome 💜