I was trying to see if I can collect information from list based on the depth of nesting of sub-lists. But I realized that it should be accomplish-able only by tree. I learned programming binary tree in lisp to some extent but it won't be helpful and I will have to try tree with any number of child nodes. I also found out that there is 'sequence' function in lisp which can make the the work easier as I can do
li:[g,f,t,h,[a,b,c],[[t,y,u]]]
/*after filtering out non-list elements li=[[a,b,c],[[t,y,u]]]*/
IN::map(lambda([x],apply(sequence,[x]),li)
OUT:: [a,b,c,[t,y,u]]
/*Again filtering out and repeating the process will leave me with [t,y,u].*/
In this way I can collect sub-lists at different labels. I couldn't see this sequence function in Maxima. Is there any certain reason it wasn't included ?
Not sure what you want to accomplish. Maybe append
has the desired effect?
(%i1) li : [[a, b, c], [[t, y, u]]] $
(%i2) apply (append, li);
(%o2) [a, b, c, [t, y, u]]