Merge branch 'doc-todos' of git://github.com/gsmaverick/wren into gsmaverick-doc-todos

This commit is contained in:
Bob Nystrom 2015-04-22 07:22:42 -07:00
commit fea844382f
3 changed files with 44 additions and 4 deletions

View File

@ -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**

View File

@ -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.

View File

@ -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)