I’m looking for a way to access a preceding item in a list. The goal is to count a nested list and then append that nested lists’ length in the next list item. Preferably a way to do this inline
Code example:
List(List[items], this.preceding.size)
To output:
List(List(item1,item2,item3), 3)
Thanks for your help!
This sort of thing is, in general, what folds and scans are good at. I’m not sure exactly what form you want, but here is something you can work off of:
You can substitute other lists for the strings.