aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorinoas <mail@inoas.com>2022-11-12 21:54:39 +0100
committerLouis Pilfold <louis@lpil.uk>2022-11-14 11:00:16 +0000
commit68ebcbf3343a49fe27c9ef906dabd87bb004a088 (patch)
tree211c945fde55a45713b04274427ac19752802342
parent095e60103e687e92e125d6484130dfd063dc5e8a (diff)
downloadgleam_stdlib-68ebcbf3343a49fe27c9ef906dabd87bb004a088.tar.gz
gleam_stdlib-68ebcbf3343a49fe27c9ef906dabd87bb004a088.zip
2nd pass
-rw-r--r--src/gleam/float.gleam3
-rw-r--r--src/gleam/iterator.gleam6
-rw-r--r--src/gleam/list.gleam6
-rw-r--r--src/gleam/string.gleam1
4 files changed, 11 insertions, 5 deletions
diff --git a/src/gleam/float.gleam b/src/gleam/float.gleam
index 4507483..2d158ab 100644
--- a/src/gleam/float.gleam
+++ b/src/gleam/float.gleam
@@ -4,6 +4,7 @@ import gleam/order.{Order}
/// possible.
///
/// ## Examples
+///
/// ```gleam
/// > parse("2.3")
/// Ok(2.3)
@@ -29,6 +30,7 @@ if javascript {
/// Returns the string representation of the provided `Float`.
///
/// ## Examples
+///
/// ```gleam
/// > to_string(2.3)
/// "2.3"
@@ -88,6 +90,7 @@ pub fn compare(a: Float, with b: Float) -> Order {
/// e.g. 5.3 - 5.0 is not exactly 0.3 in a float
///
/// ## Examples
+///
/// ```gleam
/// > loosely_compare(5.0, with: 5.3, tolerating: 0.5)
/// Eq
diff --git a/src/gleam/iterator.gleam b/src/gleam/iterator.gleam
index 83112fa..d6a6632 100644
--- a/src/gleam/iterator.gleam
+++ b/src/gleam/iterator.gleam
@@ -197,10 +197,7 @@ pub fn to_list(iterator: Iterator(element)) -> List(element) {
/// ## Examples
///
/// ```gleam
-/// > assert Next(head, tail) =
-/// > [1, 2, 3, 4]
-/// > |> from_list
-/// > |> step
+/// > assert Next(head, tail) = [1, 2, 3, 4] |> from_list |> step
/// > head
/// 1
///
@@ -1134,6 +1131,7 @@ fn do_fold_until(
///
///
/// ## Examples
+///
/// ```gleam
/// > let f = fn(acc, e) {
/// > case e {
diff --git a/src/gleam/list.gleam b/src/gleam/list.gleam
index c001677..8131351 100644
--- a/src/gleam/list.gleam
+++ b/src/gleam/list.gleam
@@ -296,8 +296,10 @@ fn do_map(list: List(a), fun: fn(a) -> b, acc: List(b)) -> List(b) {
///
/// ## Examples
///
+/// ```gleam
/// > map([2, 4, 6], fn(x) { x * 2 })
/// [4, 8, 12]
+/// ```
///
pub fn map(list: List(a), with fun: fn(a) -> b) -> List(b) {
do_map(list, fun, [])
@@ -479,8 +481,10 @@ pub fn take(from list: List(a), up_to n: Int) -> List(a) {
///
/// ## Examples
///
+/// ```gleam
/// > new()
/// []
+/// ```
///
pub fn new() -> List(a) {
[]
@@ -1713,10 +1717,10 @@ pub fn scan(
///
/// ## Examples
///
+/// ```gleam
/// > last([])
/// Error(Nil)
///
-/// ```gleam
/// > last([1, 2, 3, 4, 5])
/// Ok(5)
/// ```
diff --git a/src/gleam/string.gleam b/src/gleam/string.gleam
index a9a47ae..c2011d8 100644
--- a/src/gleam/string.gleam
+++ b/src/gleam/string.gleam
@@ -688,6 +688,7 @@ if javascript {
/// pattern match on `String`s exactly as you would with lists.
///
/// ## Examples
+///
/// ```gleam
/// > pop_grapheme("gleam")
/// Ok(#("g", "leam"))