Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
hunkyjimpjorps committed May 23, 2024
2 parents d405a59 + 63fd331 commit 21fb891
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# v.1.0.0
# Changelog

## v.1.0.1

- Bugfix - can now get, set and drop the 0th element of an array

## v.1.0.0

- Initial release
2 changes: 1 addition & 1 deletion gleam.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name = "gary"
version = "1.0.0"
version = "1.0.1"

# Fill out these fields if you intend to generate HTML documentation or publish
# your project to the Hex package manager.
Expand Down
6 changes: 3 additions & 3 deletions src/gary/array.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ pub fn set(
at index: Int,
put item: t,
) -> Result(ErlangArray(t), ArrayError) {
use <- bool.guard(index <= 0, Error(IndexOutOfRange))
use <- bool.guard(index < 0, Error(IndexOutOfRange))
use <- bool.guard(
is_fixed_size(array) && index >= get_size(array),
Error(IndexOutOfRange),
Expand All @@ -160,7 +160,7 @@ pub fn drop(
from array: ErlangArray(t),
at index: Int,
) -> Result(ErlangArray(t), ArrayError) {
use <- bool.guard(index <= 0, Error(IndexOutOfRange))
use <- bool.guard(index < 0, Error(IndexOutOfRange))
use <- bool.guard(
is_fixed_size(array) && index >= get_size(array),
Error(IndexOutOfRange),
Expand Down Expand Up @@ -232,7 +232,7 @@ pub fn sparse_fold_right(
/// Returns `Error(IndexOutOfRange)` if the index is negative, or if it exceeds the
/// size of a fixed-size array.
pub fn get(from array: ErlangArray(t), at index: Int) -> Result(t, ArrayError) {
use <- bool.guard(index <= 0, Error(IndexOutOfRange))
use <- bool.guard(index < 0, Error(IndexOutOfRange))
use <- bool.guard(
is_fixed_size(array) && index >= get_size(array),
Error(IndexOutOfRange),
Expand Down

0 comments on commit 21fb891

Please sign in to comment.