Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Peach on a dyadic function

Tags:

kdb+

I have two lists (with atoms of different types) and would like to apply a custom dyadic function in parallel, i.e. first element of the list a with first element of the list b etc.. The non-parallel way is to use the iterator ', which works just fine, but what is the parallel alternative?

like image 713
lajosbacs Avatar asked Dec 07 '25 14:12

lajosbacs


1 Answers

You can avoid having to flip your data, which can be expensive, by composing the peach with each both

q) f:{x+y}
q) l1: 1 2 3
q) l2: 4 5 6
q) (f':)'[l1;l2]
5 7 9
q)\t:100000 (f':)'[l1;l2]
97
q)\t:100000 (f .) peach flip(l1;l2)
141

Without the peach this would just be a simple f'[l1;l2]

like image 128
Callum Biggs Avatar answered Dec 09 '25 20:12

Callum Biggs



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!