[{"data":1,"prerenderedAt":684},["ShallowReactive",2],{"/array":3,"/array-surround":674},{"id":4,"title":5,"body":6,"description":648,"extension":649,"meta":650,"navigation":667,"path":671,"seo":672,"stem":12,"__hash__":673},"content/array.md","Array Extension",{"type":7,"value":8,"toc":609},"minimark",[9,22,32,36,39,58,67,76,86,89,92,95,104,113,379,388,396,450,459,490,519,557,583],[10,11,15],"h1",{"id":12,"className":13},"array",[14],"section-heading",[16,17,21],"a",{"className":18,"href":20},[19],"section-anchor","#array","Array",[23,24,27],"h2",{"id":25,"className":26},"using",[14],[16,28,31],{"className":29,"href":30},[19],"#using","Using",[33,34,35],"p",{},"The array extension is pre-installed in NetLogo.",[33,37,38],{},"To use the array extension in your model, add a line to the top of your Code tab:",[40,41,42],"pre",{},[43,44,45,52,53,57],"code",{},[46,47,51],"span",{"className":48},[49,50],"token","keyword","extensions"," [",[46,54,12],{"className":55},[49,56],"variable","]",[33,59,60,61,63,64,66],{},"If your model already uses other extensions, then it already has an\n",[43,62,51],{}," line in it, so just add ",[43,65,12],{}," to the list.",[33,68,69,70],{},"For more information on using NetLogo extensions,\nsee the ",[16,71,75],{"href":72,"rel":73},"https://docs.netlogo.org/extensions.html",[74],"nofollow","Extensions Guide",[77,78,81],"h3",{"id":79,"className":80},"when-to-use",[14],[16,82,85],{"className":83,"href":84},[19],"#when-to-use","When to Use",[33,87,88],{},"In general, anything you can do with an array in NetLogo, you could\nalso just use a list for. But you may want to consider using an array\ninstead for speed reasons. Lists and arrays have different performance\ncharacteristics, so you may be able to make your model run faster by\nselecting the appropriate data structure.",[33,90,91],{},"Arrays are useful when you need a collection of values whose size is\nfixed. You can quickly access or alter any item in an array if you\nknow its position.",[33,93,94],{},"Unlike NetLogo’s lists and strings, arrays are “mutable”.\nThat means that you can actually modify them directly,\nrather than constructing an altered copy as with lists. If\nthe array is used in more than one place in your code, any\nchanges you make will show up everywhere. It’s tricky to write\ncode involving mutable structures and it’s easy to make subtle\nerrors or get surprising results, so we suggest sticking with lists\nand strings unless you’re certain you want and need mutability.",[77,96,99],{"id":97,"className":98},"example-use-of-array-extension",[14],[16,100,103],{"className":101,"href":102},[19],"#example-use-of-array-extension","Example use of Array Extension",[33,105,106,110],{},[107,108],"binding",{"value":109},"! prevent mustache escaping",[107,111],{"value":112},"={",[40,114,115],{},[43,116,117,122,123,122,126,122,130,122,135,52,140,57,144,147,122,151,154,156,122,160,122,164,122,167,122,170,122,173,122,176,180,182,122,185,122,189,192,194,122,197,200,202,122,206,122,209,212,213,122,217,122,221,224,225,122,228,122,231,122,235,122,238,122,241,122,244,122,248,251,252,254,122,257,260,262,122,265,122,268,122,271,122,275,122,279,122,283,287,289,122,292,122,296,122,299,302,304,122,307,310,312,122,315,122,318,122,321,325,327,122,330,333,335,122,338,122,341,122,344,348,350,122,353,356,358,122,361,122,364,122,367,122,370,122,373,122,376],{},[46,118,121],{"className":119},[49,120],"command","let"," ",[46,124,16],{"className":125},[49,56],[46,127,129],{"className":128},[49,56],"array:from-list",[46,131,134],{"className":132},[49,133],"reporter","n-values",[46,136,139],{"className":137},[49,138],"number","5",[46,141,143],{"className":142},[49,138],"0",[145,146],"br",{},[46,148,150],{"className":149},[49,120],"print",[46,152,16],{"className":153},[49,56],[145,155],{},[46,157,159],{"className":158},[49,56],"=>",[46,161,163],{"className":162},[49,56],"{{array:",[46,165,143],{"className":166},[49,138],[46,168,143],{"className":169},[49,138],[46,171,143],{"className":172},[49,138],[46,174,143],{"className":175},[49,138],[46,177,179],{"className":178},[49,56],"0}}",[145,181],{},[46,183,150],{"className":184},[49,120],[46,186,188],{"className":187},[49,56],"array:length",[46,190,16],{"className":191},[49,56],[145,193],{},[46,195,159],{"className":196},[49,56],[46,198,139],{"className":199},[49,138],[145,201],{},[46,203,205],{"className":204},[49,120],"foreach",[46,207,134],{"className":208},[49,133],[46,210,139],{"className":211},[49,138]," [ ",[46,214,216],{"className":215},[49,56],"i",[46,218,220],{"className":219},[49,133],"->",[46,222,216],{"className":223},[49,56]," ] [ ",[46,226,216],{"className":227},[49,56],[46,229,220],{"className":230},[49,133],[46,232,234],{"className":233},[49,56],"array:set",[46,236,16],{"className":237},[49,56],[46,239,216],{"className":240},[49,56],[46,242,216],{"className":243},[49,56],[46,245,247],{"className":246},[49,133],"*",[46,249,216],{"className":250},[49,56]," ]",[145,253],{},[46,255,150],{"className":256},[49,120],[46,258,16],{"className":259},[49,56],[145,261],{},[46,263,159],{"className":264},[49,56],[46,266,163],{"className":267},[49,56],[46,269,143],{"className":270},[49,138],[46,272,274],{"className":273},[49,138],"1",[46,276,278],{"className":277},[49,138],"4",[46,280,282],{"className":281},[49,138],"9",[46,284,286],{"className":285},[49,56],"16}}",[145,288],{},[46,290,150],{"className":291},[49,120],[46,293,295],{"className":294},[49,56],"array:item",[46,297,16],{"className":298},[49,56],[46,300,143],{"className":301},[49,138],[145,303],{},[46,305,159],{"className":306},[49,56],[46,308,143],{"className":309},[49,138],[145,311],{},[46,313,150],{"className":314},[49,120],[46,316,295],{"className":317},[49,56],[46,319,16],{"className":320},[49,56],[46,322,324],{"className":323},[49,138],"3",[145,326],{},[46,328,159],{"className":329},[49,56],[46,331,282],{"className":332},[49,138],[145,334],{},[46,336,234],{"className":337},[49,56],[46,339,16],{"className":340},[49,56],[46,342,324],{"className":343},[49,138],[46,345,347],{"className":346},[49,138],"50",[145,349],{},[46,351,150],{"className":352},[49,120],[46,354,16],{"className":355},[49,56],[145,357],{},[46,359,159],{"className":360},[49,56],[46,362,163],{"className":363},[49,56],[46,365,143],{"className":366},[49,138],[46,368,274],{"className":369},[49,138],[46,371,278],{"className":372},[49,138],[46,374,347],{"className":375},[49,138],[46,377,286],{"className":378},[49,56],[23,380,383],{"id":381,"className":382},"primitives",[14],[16,384,387],{"className":385,"href":386},[19],"#primitives","Primitives",[33,389,390,391,395],{},"Looking for the primitive reference for the Array extension? You can find ",[16,392,394],{"href":393},"/array/dictionary","the full reference here",".",[397,398,402,403,409,410,415,416,409,422,415,425,409,431,415,434,409,440,415,443],"div",{"id":399,"className":400},"all",[401],"prose","\n  ",[16,404,407],{"className":405,"href":406},[43],"#from-list",[43,408,129],{},"\n   ",[46,411,414],{"className":412},[413],"font-bold"," · "," \n  ",[16,417,420],{"className":418,"href":419},[43],"#item",[43,421,295],{},[46,423,414],{"className":424},[413],[16,426,429],{"className":427,"href":428},[43],"#set",[43,430,234],{},[46,432,414],{"className":433},[413],[16,435,438],{"className":436,"href":437},[43],"#length",[43,439,188],{},[46,441,414],{"className":442},[413],[16,444,447],{"className":445,"href":446},[43],"#to-list",[43,448,449],{},"array:to-list",[77,451,454],{"id":452,"className":453},"all-primitives",[14],[16,455,458],{"className":456,"href":457},[19],"#all-primitives","All Primitives",[397,460,402,464,402,470,487],{"className":461,"id":463},[462],"dict_entry","from-list",[77,465,467,468,402],{"id":466},"arrayfrom-list","\n    ",[16,469,129],{"href":406},[471,472,475],"h4",{"id":473,"className":474},"arrayfrom-list-netlogo-list",[14],[16,476,467,479,402],{"className":477,"href":478},[19],"#----arrayfrom-list-netlogo-list--",[46,480,483,484],{"className":481},[482],"prim_example","array:from-list ",[216,485,486],{},"netlogo-list",[33,488,489],{},"Reports a new array containing the same items in the same order as the input list.",[397,491,402,494,402,499,516],{"className":492,"id":493},[462],"item",[77,495,467,497,402],{"id":496},"arrayitem",[16,498,295],{"href":419},[471,500,503],{"id":501,"className":502},"arrayitem-array-index",[14],[16,504,467,507,402],{"className":505,"href":506},[19],"#----arrayitem-array-index--",[46,508,510,511,122,513],{"className":509},[482],"array:item ",[216,512,12],{},[216,514,515],{},"index",[33,517,518],{},"Reports the item in the given array with the given index (ranging from zero to the length of the array minus one).",[397,520,402,523,402,528,547,550],{"className":521,"id":522},[462],"set",[77,524,467,526,402],{"id":525},"arrayset",[16,527,234],{"href":428},[471,529,532],{"id":530,"className":531},"arrayset-array-index-value",[14],[16,533,467,536,402],{"className":534,"href":535},[19],"#----arrayset-array-index-value--",[46,537,539,540,122,542,122,544],{"className":538},[482],"array:set ",[216,541,12],{},[216,543,515],{},[216,545,546],{},"value",[33,548,549],{},"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.",[33,551,552,553,556],{},"Note that unlike the ",[43,554,555],{},"replace-item"," primitive for lists, a new array is not created.\nThe given array is actually modified.",[397,558,402,561,402,566,580],{"className":559,"id":560},[462],"length",[77,562,467,564,402],{"id":563},"arraylength",[16,565,188],{"href":437},[471,567,570],{"id":568,"className":569},"arraylength-array",[14],[16,571,467,574,402],{"className":572,"href":573},[19],"#----arraylength-array--",[46,575,577,578],{"className":576},[482],"array:length ",[216,579,12],{},[33,581,582],{},"Reports the length of the given array, that is, the number of items in the array.",[397,584,402,587,402,592,606],{"className":585,"id":586},[462],"to-list",[77,588,467,590,402],{"id":589},"arrayto-list",[16,591,449],{"href":446},[471,593,596],{"id":594,"className":595},"arrayto-list-array",[14],[16,597,467,600,402],{"className":598,"href":599},[19],"#----arrayto-list-array--",[46,601,603,604],{"className":602},[482],"array:to-list ",[216,605,12],{},[33,607,608],{},"Reports a new list containing the same items in the same order as the given array.",{"title":610,"searchDepth":611,"depth":612,"links":613},"",5,3,[614,619],{"id":25,"depth":615,"text":31,"children":616},2,[617,618],{"id":79,"depth":612,"text":85},{"id":97,"depth":612,"text":103},{"id":381,"depth":615,"text":387,"children":620},[621,622,628,633,638,643],{"id":452,"depth":612,"text":458},{"id":466,"depth":612,"text":623,"children":624},"\n    array:from-list\n  ",[625],{"id":473,"depth":626,"text":627},4,"\n    array:from-list netlogo-list\n  ",{"id":496,"depth":612,"text":629,"children":630},"\n    array:item\n  ",[631],{"id":501,"depth":626,"text":632},"\n    array:item array index\n  ",{"id":525,"depth":612,"text":634,"children":635},"\n    array:set\n  ",[636],{"id":530,"depth":626,"text":637},"\n    array:set array index value\n  ",{"id":563,"depth":612,"text":639,"children":640},"\n    array:length\n  ",[641],{"id":568,"depth":626,"text":642},"\n    array:length array\n  ",{"id":589,"depth":612,"text":644,"children":645},"\n    array:to-list\n  ",[646],{"id":594,"depth":626,"text":647},"\n    array:to-list array\n  ","Documentation for the Array extension.","md",{"source":651,"metadataOutputPath":652,"projectConfig":653,"language":660,"inheritFrom":668,"output":667,"version":654,"icon":669,"extensionName":670,"assetsRoot":655},"../../external/extensions/array/array.md","content/array.metadata.yaml",{"version":654,"projectRoot":395,"scanRoot":655,"outputRoot":656,"defaults":657,"engine":663,"partials":664,"dedupeIdenticalDiskWrites":667},"7.0.4","/home/runner/work/Helio/Helio/external/extensions/array","content",{"inheritFrom":658,"language":660,"output":661,"extension":649,"title":662,"version":654},[659],0,"en",false,"NetLogo User Manual","mustache",{"directoryPaths":665,"extensions":666},[395],[663,649],true,[659],"i-material-symbols-data-array",{"shortName":12,"fullName":21},"/array",{"title":5,"description":648},"Usf77dYCZBNIi6y7rLVKQ_Quuoc9lZUIsyn8V4Jki68",[675,680],{"title":676,"path":677,"stem":678,"description":679},"Arduino Extension Dictionary: write-string","/arduino/write-string","arduino/write-string","Documentation for the write-string primitive.",{"title":681,"path":393,"stem":682,"description":683},"Array Extension Dictionary: dictionary","array/dictionary","Documentation for the dictionary primitive.",1777657789541]