2017년 5월 19일 금요일

What is a list ?


From the documentation, a list is a 1 dimensional matrix of space separated items enclosed by brackets.

I've created such a list from a returned Json string, stripping off everything I don't need, and AI tells me it's not a list.
So what is a list then.


--
I've created such a list from a returned Json string,
to convert a JSON string into a list, use the JsonTextDecode method from the web component



any JsonTextDecode(text jsonText)
Decodes the given JSON encoded value to produce a corresponding AppInventor value. A JSON list [x, y, z] decodes to a list (x y z), A JSON object with name A and value B, (denoted as A:B enclosed in curly braces) decodes to a list ((A B)), that is, a list containing the two-element list (A B).

--
A list is a chain of items in memory, each pointing to the next item in the list.
It is not an array, which gets pre-allocated memory to put the items in adjacent locations in memory.

See attached for a dangerous but simple list that will bust the stack if you try to generate a text version of it.

Ouroboros is the Greek legendary snake that survives by eating itself, tail first.



--

댓글 없음:

댓글 쓰기