Lists/Arrays

Add/Get/Remove

get

Get an item from the list at the index provided.

 

{ }
[{"paths":[],"data":{"call":"list\/array.get","list\/array":"list\/array","list\/array.get":"get","uuid":"071651f79538c5be3173b651cc9bcb7e","args":{"list":["a","long","time","ago","in","a","galaxy","far,","far","away","..."],"item":2},"height":32,"width":120,"step":"Get item 2","data_to_var":"item","y":0,"x":0,"type":"library","maxpaths":1}}]

Example Response

{"item":"time"}

append

Add an item to the end of the list.

 

{ }
[{"paths":["071651f79538c5be3173b651cc9bcb7e"],"data":{"uuid":"640cc9a1dd7ae3878d61146ebf77a211","val":["hello"],"width":120,"height":32,"y":0,"step":"Create my_list","var":"my_list","x":0,"type":"variable","maxpaths":1}},{"paths":["9105310d3521caac02031125e66e066d"],"data":{"list\/array":"list\/array","call":"list\/array.append","list\/array.append":"append","uuid":"071651f79538c5be3173b651cc9bcb7e","args":{"item":"world","list":"{\"~\":\"my_list\"}"},"height":32,"width":120,"step":"Append to my_list","data_to_var":"","y":80,"x":0,"type":"library","maxpaths":1}},{"paths":[],"data":{"uuid":"9105310d3521caac02031125e66e066d","data":"{\"~\":\"my_list\"}","height":32,"width":120,"step":"Return my_list","y":160,"x":0,"type":"return","maxpaths":0}}]

Example Response

{"my_list":["hello","world"]}

extend

Extend the list by appending all the items in the given list.

 

{ }
[{"paths":["071651f79538c5be3173b651cc9bcb7e"],"data":{"uuid":"640cc9a1dd7ae3878d61146ebf77a211","val":["a","long","time","ago"],"width":120,"height":32,"y":0,"step":"Create my_list","var":"my_list","x":0,"type":"variable","maxpaths":1}},{"paths":["9105310d3521caac02031125e66e066d"],"data":{"list\/array":"list\/array","list\/array.extend":"extend","uuid":"071651f79538c5be3173b651cc9bcb7e","args":{"item":["in","a","galaxy","far,","far","away","..."],"list":"{\"~\":\"my_list\"}"},"height":32,"width":120,"step":"Extend my_list","call":"list\/array.extend","data_to_var":"","y":80,"x":0,"type":"library","maxpaths":1}},{"paths":[],"data":{"uuid":"9105310d3521caac02031125e66e066d","data":"{\"~\":\"my_list\"}","height":32,"width":120,"step":"Return my_list","y":160,"x":0,"type":"return","maxpaths":0}}]

Example Response

{"my_list":["a","long","time","ago","in","a","galaxy","far,","far","away","..."]}

insert

Insert an item at a given position. The first argument is the index of the element before which to insert, so a.insert(0, x) inserts at the front of the list, and a.insert(len(a), x) is equivalent to a.append(x).

 

{ }
[{"paths":["071651f79538c5be3173b651cc9bcb7e"],"data":{"uuid":"640cc9a1dd7ae3878d61146ebf77a211","val":["a","long","time","ago","in","a","galaxy","far","away","..."],"width":120,"height":32,"y":0,"step":"Create my_list","var":"my_list","x":0,"type":"variable","maxpaths":1}},{"paths":["9105310d3521caac02031125e66e066d"],"data":{"list\/array":"list\/array","call":"list\/array.insert","list\/array.insert":"insert","uuid":"071651f79538c5be3173b651cc9bcb7e","args":{"list":"{\"~\":\"my_list\"}","item":"far,","index":7},"height":32,"width":120,"step":"Insert into my_list","data_to_var":"","y":80,"x":0,"type":"library","maxpaths":1}},{"paths":[],"data":{"uuid":"9105310d3521caac02031125e66e066d","data":"{\"~\":\"my_list\"}","height":32,"width":120,"step":"Return my_list","y":160,"x":0,"type":"return","maxpaths":0}}]

Example Response

{"my_list":["a","long","time","ago","in","a","galaxy","far,","far","away","..."]}

remove

Remove the first item from the list whose value is x. It is an error if there is no such item.

 

{ }
[{"paths":["071651f79538c5be3173b651cc9bcb7e"],"data":{"uuid":"640cc9a1dd7ae3878d61146ebf77a211","val":["hello","world"],"width":120,"height":32,"y":0,"step":"my list","var":"my_list","x":0,"type":"variable","maxpaths":1}},{"paths":["9105310d3521caac02031125e66e066d"],"data":{"call":"list\/array.remove","list\/array":"list\/array","list\/array.remove":"remove","uuid":"071651f79538c5be3173b651cc9bcb7e","args":{"item":"world","list":"{\"~\":\"my_list\"}"},"height":32,"width":120,"step":"Remove 'world' from my_list","data_to_var":"","y":80,"x":0,"type":"library","maxpaths":1}},{"paths":[],"data":{"uuid":"9105310d3521caac02031125e66e066d","data":"{\"~\":\"my_list\"}","height":32,"width":120,"step":"Return data","y":160,"x":0,"type":"return","maxpaths":0}}]

Example Response

{"my_list":["hello"]}

pop

Sort the items of the list in place.

 

{ }
[{"paths":[],"data":{"call":"list\/array.pop","list\/array":"list\/array","list\/array.pop":"pop","uuid":"071651f79538c5be3173b651cc9bcb7e","args":{"list":["a","long","time","ago","in","a","galaxy","far,","far","away","..."]},"height":32,"width":120,"step":"Pop item","data_to_var":"popped","y":0,"x":0,"type":"library","maxpaths":1}}]

Example Response

{"popped":"..."}

shift

Shifts the first value of the list/array off and returns it, shortening the list/array by one element and moving everything down. All numerical array keys will be modified to start counting from zero while literal keys won't be touched.

 

{ }
[{"paths":[],"data":{"call":"list\/array.shift","list\/array":"list\/array","list\/array.shift":"shift","uuid":"071651f79538c5be3173b651cc9bcb7e","args":{"list":["a","long","time","ago","in","a","galaxy","far,","far","away","..."]},"height":32,"width":120,"step":"Shift item","data_to_var":"shifted","y":0,"x":0,"type":"library","maxpaths":1}}]

Example Response

{"shifted":"a"}

slice

Extract a slice of the array. Slice returns the sequence of elements from the array array as specified by the offset and length parameters

 

{ }
[{"paths":[],"data":{"call":"list\/array.slice","list\/array":"list\/array","list\/array.slice":"slice","uuid":"071651f79538c5be3173b651cc9bcb7e","args":{"list":["a","long","time","ago","in","a","galaxy","far,","far","away","..."],"start":1,"end":3},"height":32,"width":120,"step":"Slice list","data_to_var":"sliced","y":0,"x":0,"type":"library","maxpaths":1}}]

Example Response

{"sliced":["long","time"]}

splice

Remove a portion of the array and replace it with something else. Removes the elements designated by start and end from the input array, and replaces them with the elements of the replacement array, if supplied. Note that numeric keys in input are not preserved.

 

{ }
[{"paths":[],"data":{"call":"list\/array.splice","list\/array":"list\/array","list\/array.splice":"splice","uuid":"071651f79538c5be3173b651cc9bcb7e","args":{"list":["a","long","time","ago","in","a","galaxy","far,","far","away","..."],"values":["close,","close","nearby"],"start":7,"end":10},"height":32,"width":120,"step":"Splice list","data_to_var":"spliced","y":0,"x":0,"type":"library","maxpaths":1}}]

Example Response

{"spliced":["a","long","time","ago","in","a","galaxy","close,","close","nearby","..."]}

unshift

Prepends passed elements to the front of the array. Note that the list of elements is prepended as a whole, so that the prepended elements stay in the same order. All numerical array keys will be modified to start counting from zero while literal keys won't be touched.

 

{ }
[{"paths":[],"data":{"call":"list\/array.unshift","list\/array":"list\/array","list\/array.unshift":"unshift","uuid":"071651f79538c5be3173b651cc9bcb7e","args":{"list":["a","long","time","ago","in","a","galaxy","far,","far","away","..."],"values":["star","wars","intro:"]},"height":32,"width":120,"step":"Add items to front of list","data_to_var":"unshifted","y":0,"x":0,"type":"library","maxpaths":1}}]

Example Response

{"unshifted":["star","wars","intro:","a","long","time","ago","in","a","galaxy","close,","close","nearby","..."]}