859 B
859 B
| id | name | category | kind | tokens | sig | tip | order | ns | member |
|---|---|---|---|---|---|---|---|---|---|
| list-reverse | List.reverse | list | namespace-method | List.reverse | List.reverse(s) -> void | Reverse the order of a slice in place. | 9 | List | reverse |
Reverses s so its first element becomes last and vice versa, mutating the slice in place rather than returning a copy. Use it to flip an order you built back-to-front — a path traced from goal to start, an undo stack you want oldest-first, or a list you appended to and now want to read in the opposite direction.
Parameters:
s— the slice to reverse
program PathOrder {
state PathOrderState {
path: []int = new []int
}
handler Finalize(path_order_st: PathOrderState) phase Update {
# path was built from the goal back to the start
List.reverse(path_order_st.path) # now start -> goal
}
}