stdlib
stdlib copied to clipboard
🎁 Gleam's standard library
I started looking at the state of random in Gleam and I have several ideas. 1. `int.random` and `float.random` do not have seeds. It might be a problem for libraries....
This would take a string and return a string with all regex-specific characters escaped so that it would match the literal string if compiled to a regex. It would be...
Fixes https://github.com/gleam-lang/stdlib/issues/667. ~New `list.unique` implementation uses `gleam/set` to detect whether item has already been seen.~ New `list.unique` implementation uses `gleam/dict` to detect whether item has already been seen (it can't...
Hello. According to the documentation `list.unique` returns in loglinear time. But it's implementation ```gleam pub fn unique(list: List(a)) -> List(a) { case list { [] -> [] [x, ..rest] ->...
Replaces https://github.com/gleam-lang/stdlib/pull/610
As it is now, you have the ability to write named capturing groups, but those results don't appear in the list of matches returned from `regex.scan`. ```gleam import gleam/io import...
Improve `float.to_string` to handle exponentials properly. Also address https://github.com/gleam-lang/stdlib/issues/694. Before this PR `float.to_string(1.0e123)` would output `1e+123.0` and had another issues.
This can be merged only after has been merged.
Fixes https://github.com/gleam-lang/stdlib/issues/587 The primary intent of this PR is to add `trim_with`, `trim_start_with` and `trim_end_with` to the `string` module, which will trim the specified chars from both ends of a...
Added `regex.escape` to escape regex strings. I saw the issue for this and needed the same, so here it is! It takes a string, escapes all regex chars, and returns...