Lists/Arrays

Operations

sort

Sort the items of the list in place.

 

{ }
[{"paths":["071651f79538c5be3173b651cc9bcb7e"],"data":{"uuid":"640cc9a1dd7ae3878d61146ebf77a211","val":["a","long","time","ago","in","a","galaxy","far,","far","away","..."],"width":120,"height":32,"y":0,"step":"Create my_list","var":"my_list","x":0,"type":"variable","maxpaths":1}},{"paths":["9105310d3521caac02031125e66e066d"],"data":{"call":"list\/array.sort","list\/array":"list\/array","list\/array.sort":"sort","uuid":"071651f79538c5be3173b651cc9bcb7e","args":{"list":"{\"~\":\"my_list\"}"},"height":32,"width":120,"step":"Sort 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","a","ago","away","far","far,","galaxy","in","long","time"]}

reverse

Reverse the elements of the list, in place.

 

{ }
[{"paths":["071651f79538c5be3173b651cc9bcb7e"],"data":{"uuid":"640cc9a1dd7ae3878d61146ebf77a211","val":["a","long","time","ago","in","a","galaxy","far,","far","away","..."],"width":120,"height":32,"y":0,"step":"Create my_list","var":"my_list","x":0,"type":"variable","maxpaths":1}},{"paths":["9105310d3521caac02031125e66e066d"],"data":{"call":"list\/array.reverse","list\/array":"list\/array","list\/array.reverse":"reverse","uuid":"071651f79538c5be3173b651cc9bcb7e","args":{"list":"{\"~\":\"my_list\"}"},"height":32,"width":120,"step":"Reverse 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":["...","away","far","far,","galaxy","a","in","ago","time","long","a"]}

join

Concatenate a list/array of words with intervening occurrences of separator. The default value for separator is a single space character.

 

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

Example Response

{"joined":"a long time ago in a galaxy far, far away ..."}

flatten

Flattens a multidimensional array into a single array.

 

{ }
[{"paths":[],"data":{"call":"list\/array.flatten","list\/array":"list\/array","list\/array.flatten":"flatten","uuid":"071651f79538c5be3173b651cc9bcb7e","args":{"list":[1,2,3,[4,5,[6,7]],[[[8]]]]},"height":32,"width":120,"step":"Flatten list","data_to_var":"flattened","y":0,"x":0,"type":"library","maxpaths":1}}]

Example Response

{"flattened":[1,2,3,4,5,6,7,8]}

empty

Removes all elements of a list, in place.

 

{ }
[{"paths":["071651f79538c5be3173b651cc9bcb7e"],"data":{"uuid":"640cc9a1dd7ae3878d61146ebf77a211","val":["a","long","time","ago","in","a","galaxy","far,","far","away","..."],"width":120,"height":32,"y":0,"step":"Create my_list","var":"my_list","x":0,"type":"variable","maxpaths":1}},{"paths":["9105310d3521caac02031125e66e066d"],"data":{"call":"list\/array.empty","list\/array":"list\/array","list\/array.empty":"empty","uuid":"071651f79538c5be3173b651cc9bcb7e","args":{"list":"{\"~\":\"my_list\"}"},"height":32,"width":120,"step":"Empty 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":[]}

zip

This function returns a list/array of list/arrays, where the i-th list/array contains the i-th element from each of the argument sequences or iterables. The returned list/array is truncated in length to the length of the shortest argument sequence. When there are multiple arguments which are all of the same length, zip() is similar to map() with an initial argument of None. With a single sequence argument, it returns a list of 1-tuples. With no arguments, it returns an empty list.

 

{ }
[{"paths":[],"data":{"call":"list\/array.zip","list\/array":"list\/array","list\/array.zip":"zip","uuid":"071651f79538c5be3173b651cc9bcb7e","args":{"lists":[[1,2,3],[4,5,6]]},"height":32,"width":120,"step":"Zip lists","data_to_var":"zipped","y":0,"x":0,"type":"library","maxpaths":1}}]

Example Response

{"zipped":[[1,4],[2,5],[3,6]]}

range

This is a versatile function to create lists containing arithmetic progressions. It is most often used in for loops. The arguments must be plain integers. If the step argument is omitted, it defaults to 1.

 

{ }
[{"paths":[],"data":{"call":"list\/array.range","list\/array":"list\/array","list\/array.range":"range","uuid":"071651f79538c5be3173b651cc9bcb7e","args":{"count":10,"step":2},"height":32,"width":120,"step":"Create range","data_to_var":"range","y":0,"x":0,"type":"library","maxpaths":1}}]

Example Response

{"range":[0,2,4,6,8]}

contains

Checks to see if a list/array contains a value.

 

{ }
[{"paths":[],"data":{"call":"list\/array.contains","list\/array":"list\/array","list\/array.contains":"contains","uuid":"071651f79538c5be3173b651cc9bcb7e","args":{"list":["a","long","time","ago","in","a","galaxy","close,","close","nearby","..."],"value":"galaxy"},"height":32,"width":120,"step":"Create range","data_to_var":"contains_galaxy","y":0,"x":0,"type":"library","maxpaths":1}}]

Example Response

{"contains_galaxy":true}

length

Return the quantity of items stored in a list/array

 

{ }
[{"data":{"call":"list\/array.contains","list\/array":"list\/array","list\/array.contains":"contains","type":"library","step":"Get length of list\/array","args":{"item":"[\"luke\",\"leia\",\"han\"]"},"data_to_var":"list_length","maxpaths":1,"uuid":"9148d39266042bc89aff74e46b1a483b","x":0,"y":0,"width":120,"height":32},"paths":[]}]

Example Response

{"list_length":3}

sum

Sums start and the items of an iterable from left to right and returns the total. start defaults to 0. The iterable's items are normally numbers, and the start value is not allowed to be a string.

 

{ }
[{"paths":[],"data":{"call":"list\/array.sum","list\/array":"list\/array","list\/array.sum":"sum","uuid":"071651f79538c5be3173b651cc9bcb7e","args":{"list":[1,2,3,4,5,6,7,8,9]},"height":32,"width":120,"step":"Sum list","data_to_var":"summed","y":0,"x":0,"type":"library","maxpaths":1}}]

Example Response

{"summed":45}

json

Converts list/array to a JSON-encoded string.

 

{ }
[{"paths":[],"data":{"call":"list\/array.json","list\/array":"list\/array","list\/array.json":"json","uuid":"071651f79538c5be3173b651cc9bcb7e","args":{"list":["a","long","time","ago","in","a","galaxy","close,","close","nearby","..."]},"height":32,"width":120,"step":"Create range","data_to_var":"json_list","y":0,"x":0,"type":"library","maxpaths":1}}]

Example Response

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