stdlib
stdlib copied to clipboard
🎁 Gleam's standard library
Issue gleam-lang/gleam#1262 Still WIP but creating PR for feedback. Reference Implementation https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/PersistentHashMap.java
https://github.com/gleam-lang/stdlib/blob/v0.22.3/src/gleam/string.gleam#L253 `to_graphemes` is recursive, will recurse once per item in the string
In dynamic, we have "field" when we're using JSON as an "record", when we know the keys. But when it's a mapping (random key -> value) represented as an object...
is this a good idea?: add larger tests to recursive functions: - makes sure tco happens now - makes sure tco happens in future - helps detecting if runtime implementation...
Takes a list and groups the values by a key which is built from a key_selector function and the values are stored in a new List. ## Example ```gleam [Ok(3),...
``` import gleeunit import gleam/bit_builder pub fn main() { gleeunit.main() } pub fn bit_string_size_test() { |> bit_builder.from_bit_string() |> bit_builder.byte_size() } ``` crashes with ``` λ ~/bitstringsize/ master* gleam test Compiling...
Currently `from_map*` functions are there only for Erlang because I haven't figured out how to work with the `gleam_stdlib.js` one.
So this is an inductive/brute force test (no proof). Before I continue, because this is a bit tedious, I wanted to get a heads up if my approach is good...
Current `uri.parse` does not follow the RFC. JS `new URL("")` does not follow that RFC, either. Specifically, "ws:path" is not split into a scheme and a path. This would be...
When writing a comparison function, a common pattern is to compare one thing, then if its equal compare another thing and so on. e.g. ```gleam fn compare_cat(a: Cat, b: Cat)...