From d3b25d280046073d980ad0bb483ae02b7797ea3d Mon Sep 17 00:00:00 2001 From: NicklasXYZ Date: Wed, 4 Jan 2023 20:39:01 +0100 Subject: [PATCH] Update README --- README.md | 49 +++++++++++++++++------- src/gleam_community/maths/int_list.gleam | 3 -- 2 files changed, 35 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index ac7203d..8567f6e 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,45 @@ -# maths +# gleam-community/maths -[![Package Version](https://img.shields.io/hexpm/v/maths)](https://hex.pm/packages/maths) -[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/maths/) +[![Package Version](https://img.shields.io/hexpm/v/gleam_community_maths)](https://hex.pm/packages/gleam_community_maths) +[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/gleam_community_maths/) -A Gleam project +A basic mathematics library that contains some of the most fundamental mathematics functions and utilities. -## Quick start +The library supports both targets: Erlang and JavaScript. + +## Quickstart + +```gleam +import gleam_community/maths/float as floatx +import gleam_community/maths/int as intx +import gleam_community/maths/float_list +import gleam_community/maths/int_list + +pub fn main() { + // Evaluate the sine function + floatx.sin(floatx.pi()) + // Returns Float: 0.0 + + // Find the greatest common divisor + intx.gcd(54, 24) + // Returns Int: 6 + + // Find the minimum and maximum of a list + float_list.extrema([10.0, 3.0, 50.0, 20.0, 3.0]) + // Returns Tuple: Ok(#(3.0, 50.0)) + + // Find the list indices of the largest values + int_list.argmax([10.0, 3.0, 50.0, 20.0, 3.0]) + // Returns List: Ok([1, 4]) +} -```sh -gleam run # Run the project -gleam test # Run the tests -gleam shell # Run an Erlang shell ``` ## Installation -If available on Hex this package can be added to your Gleam project: +`gleam_community` packages are published to [hex.pm](https://hex.pm/packages/gleam_community_maths) +with the prefix `gleam_community_`. You can add them to your Gleam projects directly: ```sh -gleam add maths -``` - -and its documentation can be found at . +gleam add gleam_community_maths +``` \ No newline at end of file diff --git a/src/gleam_community/maths/int_list.gleam b/src/gleam_community/maths/int_list.gleam index d448316..a4ae823 100644 --- a/src/gleam_community/maths/int_list.gleam +++ b/src/gleam_community/maths/int_list.gleam @@ -27,13 +27,10 @@ //// --- //// //// * **Miscellaneous functions** -//// * [`allclose`](#allclose) //// * [`amax`](#amax) //// * [`amin`](#amin) //// * [`argmax`](#argmax) //// * [`argmin`](#argmin) -//// * [`allclose`](#allclose) -//// * [`trim`](#trim) import gleam/list import gleam/int