diff --git a/doc/site/core/fiber.markdown b/doc/site/core/fiber.markdown index b93d0095..8f9f3c87 100644 --- a/doc/site/core/fiber.markdown +++ b/doc/site/core/fiber.markdown @@ -75,11 +75,29 @@ Similar to `Fiber.yield` but provides a value to return to the parent fiber's ### **call**() -**TODO** +Invokes the fiber or resumes the fiber if it is in a paused state. + + :::dart + var fiber = new Fiber { + IO.print("Fiber called") + Fiber.yield() + IO.print("Fiber called again") + } + fiber.call() + fiber.call() ### **call**(value) -**TODO** +Invokes the fiber or resumes the fiber if it is in a paused state and sets +`value` as the returned value of the fiber's call to `yield`. + + :::dart + var fiber = new Fiber { + var value = Fiber.yield() + IO.print(value + 1) + } + fiber.call() + fiber.call(1) // 2. ### **isDone** diff --git a/doc/site/core/fn.markdown b/doc/site/core/fn.markdown index 6677be39..bbbbc404 100644 --- a/doc/site/core/fn.markdown +++ b/doc/site/core/fn.markdown @@ -30,4 +30,14 @@ The number of arguments the function requires. ### **call**(args...) -**TODO** +Invokes the function with the given arguments. + + :::dart + var fn = new Fn { |arg| + IO.print(arg) + } + fn.call("Hello world") // Hello world. + +It is a runtime error if the number of arguments given is less than the arity of +the function. If more arguments are given than the arity of the function they +will be discarded. \ No newline at end of file diff --git a/doc/site/core/list.markdown b/doc/site/core/list.markdown index 89961168..a4577028 100644 --- a/doc/site/core/list.markdown +++ b/doc/site/core/list.markdown @@ -21,7 +21,19 @@ The number of elements in the list. ### **insert**(index, item) -**TODO** +Inserts the `item` at the `index` in the list. + + :::dart + var list = ["a", "b", "c", "d"] + list.insert(1, "e") + IO.print(list) // "[a, e, b, c, d]" + +Returns the inserted item. + + :::dart + IO.print(["a", "c"].insert(1, "b")) // "b". + +It is a runtime error if the index is not an integer or is out of bounds. ### **iterate**(iterator), **iteratorValue**(iterator)