diff --git a/book/src/language-tour/list.md b/book/src/language-tour/list.md index 32656cf4..1c38e90d 100644 --- a/book/src/language-tour/list.md +++ b/book/src/language-tour/list.md @@ -1,11 +1,13 @@ # List -Aiken lists are plutus linked lists. Accessing by index is O(n). Appending or accessing head is O(1). Grabbing tail is O(1). +Aiken lists are plutus linked lists. +Accessing by index is O(n). +Appending or accessing head is O(1). +Grabbing tail is O(1). There is no builtin syntax for accessing by index as this is implemented by standard libs. Accessing head, tail, or preceding elements can be done by pattern matching. - ```gleam // this function checks if a list has a sequence of 1 then 2 contained within it. fn listStuff(a: List(Int)){ @@ -18,4 +20,6 @@ fn listStuff(a: List(Int)){ ``` Helper functions for safely accessing head, tail, are provided in standard lib but are implemented using comprehensions. -It is usually best to use your own comprehensions for efficiency (until the optimiser is better). \ No newline at end of file +It is usually best to use your own comprehensions for efficiency (until the optimiser is better). + +It is best to avoid accesses by indexes if possible for efficiency. \ No newline at end of file