Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion USING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ If your model already uses other extensions, then it already has an
`extensions` line in it, so just add `array` to the list.

For more information on using NetLogo extensions,
see the [Extensions Guide](http://ccl.northwestern.edu/netlogo/docs/extensions.html)
see the [Extensions Guide](https://docs.netlogo.org/extensions.html)

### When to Use

Expand Down
70 changes: 70 additions & 0 deletions documentation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
extensionName: array
icon: i-material-symbols-data-array
filesToIncludeInManual:
- USING.md
- primitives
markdownTemplate: |2

# NetLogo Array Extension

{{> BUILDING.md}}

{{> USING.md}}

## Primitives

{{#contents}}{{#prims}}
[`{{name}}`](#{{primitive.extensionName}}{{primitive.name}})
{{/prims}}{{/contents}}

{{#primitives}}
{{> primTemplate}}
{{/primitives}}

{{> LICENSE.md}}
primTemplate: |2

### `{{name}}`

{{{description}}}
primitives:
- arguments:
- type: list
description: Reports a new array containing the same items in the same order as the input list.
name: from-list
returns: array
type: reporter
- arguments:
- type: array
- name: index
type: number
description: Reports the item in the given array with the given index (ranging from zero to the length of the array minus one).
name: item
returns: anything
type: reporter
- arguments:
- type: array
- name: index
type: number
- name: value
type: anything
description: |2

Sets the item in the given array with the given index (ranging from zero to the length of the array minus one) to the given value.

Note that unlike the `replace-item` primitive for lists, a new array is not created.
The given array is actually modified.
name: set
type: command
- arguments:
- type: array
description: Reports the length of the given array, that is, the number of items in the array.
name: length
returns: number
type: reporter
- arguments:
- type: array
description: Reports a new list containing the same items in the same order as the given array.
name: to-list
returns: list
type: reporter