The output from "make a list" is [0,0,0,0] and the output from "list from csv row text" is ["0","0","0","0"]. This is very annoying. Why is it so? How do I do to convert a csv text to a list with the output [0,0,0,0]?
You are under the mistaken assumption that you can see a list.
They exist only in memory, as chained memory locations.
What you see is a JSON or CSV text representation of the list.
(There is a third representation using parentheses, but gladly it's obsolete).
P.S. For a presentable text representation of a list, i like the JOIN With Separator ',' block.
P.P.S. I can show in three blocks how to create a list whose text representation would overflow your device's memory.
This is not the issue. It is the TextBox output that are different.
(Canned Reply: ABG- Export & Upload .aia)
Export your .aia file and upload it here.
.
..
use web. decodejsontextwithdictionary to decode string [0,0,0] to a list of numbers.
Some options:
and a procedure:
Draggable blocks (click on it, then drag or save)
and to round this off, to do the same for a csv table:
Draggable blocks (click on it, then drag or save)
Your default text display is JSON, as seen in the Project Properties.
In your code
the first line shows the JSON representation of a list of numbers (0's)
the second line shows the JSON representation of a list of text values ("0"s)
For the definition of JSON, see
https://www.json.org/json-en.html
Thank you! But how do the item*1 block work?
The technical term for this is coercion.
Multiplication forces a number data type as a result.
Yes of course. The math block produces an int.
See
for more details on AI2 internal data types.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.