stdlib
stdlib copied to clipboard
🎁 Gleam's standard library
```gleam // bit_array pub fn slice( from string: BitArray, at position: Int, take length: Int, ) -> Result(BitArray, Nil) // string pub fn slice( from string: String, at_index idx: Int,...
I noticed that there wasn't a try_ version of the filter function. - Added try_filter function to the list module - Added try_filter_test
## Issue - #541 ## Changes - Created a new to_fixed_string function in strings module - Added unit test covering multiple edge cases ## Notes Functionality works, but I feel...
In Javascript, I am able to do: ```javascript const value = 0.8999999999 const roundedValueAsString = value.toFixed(2) console.log(roundedValueAsString) // "0.90" console.log(typeof roundedValueAsString) // "string" ``` There is similar [behaviour](https://stackoverflow.com/a/55582564) in Elixir
This PR closes #579
The existing `string.trim`, `string.trim_left` and `string.trim_right` functions currently only trim whitespace. Could we add equivalent trimming functions that take the codepoints to be trimmed as an input, similar to Erlang's...
I was expecting `string.replace` to treat control characters like any other code points, but then ran into this behaviour which looks wrong. The issue is only on the Erlang target,...
This would function like [Array#count](https://ruby-doc.org/3.2.2/Array.html#method-i-count) does when it takes a block in Ruby. ```rb irb(main):001:0> list = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] => [0,...
Should close #525 by adding the `float.modulo` function. I also tried implementing the `float.remainder` function as: ``` gleam pub fn modulo(dividend: Float, by divisor: Float) -> Result(Float, Nil) { case...
It'd be nice to have a Gleam version of this function: https://www.erlang.org/doc/man/maps#merge_with-3 Basically, lets you pass in a function to resolve "merge conflicts", so you could do something like... ```gleam...