diff --git a/USING.md b/USING.md index 75d74ac..2090608 100644 --- a/USING.md +++ b/USING.md @@ -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 diff --git a/documentation.yaml b/documentation.yaml new file mode 100644 index 0000000..0557363 --- /dev/null +++ b/documentation.yaml @@ -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