Skip to content

Commit

Permalink
Merge pull request #5 from NicklasXYZ/main
Browse files Browse the repository at this point in the history
Fix various issues and todo's
  • Loading branch information
NicklasXYZ committed Sep 17, 2023
2 parents cd1f8e6 + a4eb550 commit d2241e4
Show file tree
Hide file tree
Showing 35 changed files with 7,644 additions and 7,403 deletions.
21 changes: 8 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,24 @@ on:
tags: ["v*"]

jobs:
publish:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: erlef/setup-beam@v1
- uses: actions/[email protected]
- uses: erlef/[email protected]
with:
otp-version: "25.0"
gleam-version: "0.25.3"

otp-version: "26.0.2"
gleam-version: "0.30.5"
- run: cargo install tomlq

- run: |
if [ "v$(tomlq version -f gleam.toml)" == "${{ github.ref_name }}" ]; then
exit 0
fi
echo "tag does not match version in gleam.toml, refusing to publish"
exit 1
- run: gleam format --check

- run: gleam test

- run: gleam format --check src test
- run: gleam test --target erlang
- run: gleam test --target javascript
- run: gleam publish -y
env:
HEXPM_USER: ${{ secrets.HEX_USERNAME }}
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
- uses: actions/checkout@v3.1.0
- uses: erlef/setup-beam@v1.16.0
with:
otp-version: "25.0"
gleam-version: "0.28.3"
otp-version: "26.0.2"
gleam-version: "0.30.5"
- uses: actions/[email protected]
with:
node-version: "16.18.1"
- run: gleam format --check src test
- run: gleam test --target erlang
- run: gleam test --target javascript
- run: gleam format --check src test
- run: gleam test --target javascript
33 changes: 23 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,40 @@ 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
import gleam_community/maths/elementary
import gleam_community/maths/arithmetics
import gleam_community/maths/piecewise
import gleam_community/maths/tests
import gleam/float
pub fn main() {
// Evaluate the sine function
floatx.sin(floatx.pi())
elementary.sin(floatx.pi())
// Returns Float: 0.0
// Find the greatest common divisor
intx.gcd(54, 24)
// Returns Int: 6
arithmetics.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])
piecewise.extrema([10.0, 3.0, 50.0, 20.0, 3.0], float.compare)
// Returns Tuple: Ok(#(3.0, 50.0))
// Find the list indices of the smallest value
int_list.arg_minimum([10, 3, 50, 20, 3])
// Returns List: Ok([1, 4])
piecewise.arg_minimum([10, 3, 50, 20, 3], float.compare)
// Returns List: Ok([1, 4])
// Determine if a number is fractional
tests.is_fractional(0.3333)
// Returns Bool: True
// Determine if 28 is a power of 3
tests.is_power(28, 3)
// Returns Bool: False
// Generate all k = 1 combinations of [1, 2]
combinatorics.list_combination([1, 2], 1)
// Returns List: Ok([[1], [2]])
}
```
Expand Down
4 changes: 2 additions & 2 deletions gleam.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description = "A basic maths library"
repository = { type = "github", user = "gleam-community", repo = "maths" }

[dependencies]
gleam_stdlib = "~> 0.28"
gleam_stdlib = "~> 0.30"

[dev-dependencies]
gleeunit = "~> 0.7"
gleeunit = "~> 0.10"
8 changes: 4 additions & 4 deletions manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
# You typically do not need to edit this file

packages = [
{ name = "gleam_stdlib", version = "0.28.1", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "73F0A89FADE5022CBEF6D6C3551F9ADCE7054AFCE0CB1DC4C6D5AB4CA62D0111" },
{ name = "gleeunit", version = "0.10.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "ECEA2DE4BE6528D36AFE74F42A21CDF99966EC36D7F25DEB34D47DD0F7977BAF" },
{ name = "gleam_stdlib", version = "0.30.2", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "8D8BF3790AA31176B1E1C0B517DD74C86DA8235CF3389EA02043EE4FD82AE3DC" },
{ name = "gleeunit", version = "0.11.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "1397E5C4AC4108769EE979939AC39BF7870659C5AFB714630DEEEE16B8272AD5" },
]

[requirements]
gleam_stdlib = "~> 0.28"
gleeunit = "~> 0.7"
gleam_stdlib = { version = "~> 0.30" }
gleeunit = { version = "~> 0.10" }
Loading

0 comments on commit d2241e4

Please sign in to comment.