Home › Forums › kdb+ › How to remove or add items from a list › Re: How to remove or add items from a list
-
If Im following you, your two lists
L1
andL2
are the same length. You want a listA
of the same length in which itemA[i]
is the greater ofL1[i]
andL2[i]
.The Greater operator
|
is atomic, so iterates implicitly.q)show L1:10?10. 3.927524 5.170911 5.159796 4.066642 1.780839 3.017723 7.85033 5.347096 7.111716 4.11597 q)show L2:10?10. 4.931835 5.785203 0.8388858 1.959907 3.75638 6.137452 5.294808 6.916099 2.296615 6.919531 q)show A:L1|L2 / Greater 4.931835 5.785203 5.159796 4.066642 3.75638 6.137452 7.85033 6.916099 7.111716 6.919531
A good deal of vector programming is just letting go of loops and tests. (Just takes practice.)