# Question in passing elements of 2 same-length lists by 'each' keyword

**URL:** https://forum.kx.com/t/question-in-passing-elements-of-2-same-length-lists-by-each-keyword/13953
**Category:** Community Support
**Tags:** kdb-and-q, imported
**Created:** [June 12, 2024, 4:58am UTC](https://forum.kx.com/t/question-in-passing-elements-of-2-same-length-lists-by-each-keyword/13953 "2024-06-12T04:58:05Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![jackyyuk](https://avatars.discourse-cdn.com/v4/letter/j/a4c791/32.png) [@jackyyuk](https://forum.kx.com/u/jackyyuk)
#### Post date: [June 12, 2024, 4:58am UTC](https://forum.kx.com/t/question-in-passing-elements-of-2-same-length-lists-by-each-keyword/13953/1 "2024-06-12T04:58:05Z")

</div>

[https://learninghub.kx.com/forums/topic/question-in-passing-elements-of-2-same-length-lists-by-each-keyword](https://learninghub.kx.com/forums/topic/question-in-passing-elements-of-2-same-length-lists-by-each-keyword)

Hello all,

Is it possible to pass elements of 2 same-length lists by 'each' keyword in the same time? In my case, list 1 is a nested list of lists, and list 2 contains index of the element on each row in list 1, so I would like to do something like:

{[e1;e2] e1[e2] : new values } [;] each list1,list2

Is there any simple way to do so?

Thanks very mush.

Jacky

---

<div class="post-metadata">

### Author: ![rocuinneagain](https://sea2.discourse-cdn.com/flex002/user_avatar/forum.kx.com/rocuinneagain/32/287_2.png) [@rocuinneagain](https://forum.kx.com/u/rocuinneagain)
#### Post date: [June 12, 2024, 8:32am UTC](https://forum.kx.com/t/question-in-passing-elements-of-2-same-length-lists-by-each-keyword/13953/2 "2024-06-12T08:32:18Z")

</div>

**'** form of **each** https://code.kx.com/q/ref/maps/#each

```
q){x[y]:99;x}'[(1 2 3;4 5 6;7 8 9);0 1 2]
99 2 3
4 99 6
7 8 99
```

Amend at **@** version https://code.kx.com/q/ref/apply/#amend-amend-at

```
q){@[x;y;:;99]}'[(1 2 3;4 5 6;7 8 9);0 1 2]
99 2 3
4 99 6
7 8 99
```

```
q)@[;;:;99]'[(1 2 3;4 5 6;7 8 9);0 1 2]
99 2 3
4 99 6
7 8 99
```
