What is nested list ?Explain with examples. Give a best answer so that I can make you brainliest.
Answers
Answer :
A nested list is simply a list that occurs as an element of another list (which may of course itself be an element of another list, etc.).
Common reasons nested lists arise are:
They're matrices (a list of rows, where each row is itself a list, or a list of columns where each column is itself a list).
Lists are being used for what in other languages is known as structs, records, or tuples -- collections of data with a fixed structure.
A tree is encoded as a list where the subtrees occur as elements (hence lists are nested as deeply as the tree is high).
[Discuss when using a nested list is important or useful - what are cases where it is a good solution]
Before Tcl 8.4, nested lists were quite difficult to work with -- getting nested elements required nesting lindex commands, and the nightmare of setting elements in nested lists without the help of lset is better forgotten -- and as a result older code often uses arrays even in cases where the first-class data status (being possible to pass by value) of a list would have been very useful