# Duplicate values within a nested list

**URL:** <https://forum.dynamobim.com/t/duplicate-values-within-a-nested-list/1367>\
**Category:** Packages\
**Created:** [April 23, 2015, 10:25am UTC](https://forum.dynamobim.com/t/duplicate-values-within-a-nested-list/1367 "2015-04-23T10:25:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Robert\_Van\_Lin](https://avatars.discourse-cdn.com/v4/letter/r/ea5d25/32.png) [@Robert\_Van\_Lin](https://forum.dynamobim.com/u/Robert_Van_Lin)\
**Post date:** [April 23, 2015, 10:25am UTC](https://forum.dynamobim.com/t/duplicate-values-within-a-nested-list/1367/1 "2015-04-23T10:25:26Z")

</div>

I have a list containing 40 sublists. Each sublist contains 10 items (say points A-J along a curve). I would like to end up with a list of sublists, where each sublist contains 2 items like this: List [0] contains 10 sublists. Each sublist contains a list of 2 points: list [0] contains points [A,B], list [1] contains points [B,C], list [2] contains points [C,D], etc…

![Capture](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex022/uploads/dynamobim/original/2X/4/4c33be8b986a20c077c6924384504b59dbb62934.png)

---

<div class="post-metadata">

**Author:** ![Leo\_Hart](https://avatars.discourse-cdn.com/v4/letter/l/57b2e6/32.png) [@Leo\_Hart](https://forum.dynamobim.com/u/Leo_Hart)\
**Post date:** [April 23, 2015, 2:04pm UTC](https://forum.dynamobim.com/t/duplicate-values-within-a-nested-list/1367/2 "2015-04-23T14:04:51Z")

</div>

Against this issue, I am also often. I have found two solutions. For points on a line it is easier:

![List_double](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex022/uploads/dynamobim/original/2X/8/819f3427a9b2daba1ea0be2c7747a527d8736e51.png)

My second method is to play with the list actions. It is the much longer way.

If anyone knows an easier way, please post 🙂

But I’m not quite sure if this was your problem ^^

---

<div class="post-metadata">

**Author:** ![Robert\_Van\_Lin](https://avatars.discourse-cdn.com/v4/letter/r/ea5d25/32.png) [@Robert\_Van\_Lin](https://forum.dynamobim.com/u/Robert_Van_Lin)\
**Post date:** [April 23, 2015, 2:47pm UTC](https://forum.dynamobim.com/t/duplicate-values-within-a-nested-list/1367/3 "2015-04-23T14:47:36Z")

</div>

Figured it out:

1. Created a copy of the list
2. Using List.RestOfItems, remove first item from one of the lists to offset the values.
3. Using List.Chop, divide lists into sublists each containing 2 values.
4. Using List.Join, join lists! This actually returns 2 appended lists of sublists, not laced lists of sublists, but that works for me.

NB: Use List.Map to get access to the sublists and apply each function.

![Capture](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex022/uploads/dynamobim/original/2X/0/03203a91377515534f11e3e619c7bde18dc7581b.png)

---

<div class="post-metadata">

**Author:** ![Robert\_Van\_Lin](https://avatars.discourse-cdn.com/v4/letter/r/ea5d25/32.png) [@Robert\_Van\_Lin](https://forum.dynamobim.com/u/Robert_Van_Lin)\
**Post date:** [April 23, 2015, 2:49pm UTC](https://forum.dynamobim.com/t/duplicate-values-within-a-nested-list/1367/4 "2015-04-23T14:49:59Z")

</div>

Thanks Leo!
