Map Iterators
What are they?
As per code.kx, map iterators are iterators that derive uniform functions that apply their values once to each item of a dictionary, a list, or conforming lists.
The map iterators in kdb are: each, each left, each right, each parallel (peach), each prior and case.
If you have any experience in kdb+/q you will likely have used a map iterator at some stage. They are as common to kdb as a for-loop is to other languages, and in many cases they serve the same purpose. For example:
Python:
for i in range(0,5):
print("Number is: "+str(i))
Number is: 0
Number is: 1
Number is: 2
Number is: 3
Number is: 4
kdb:
q){"Number is: ",string[x]} each til 5
"Number is: 0"
"Number is: 1"
"Number is: 2"
"Number is: 3"
"Number is: 4"
Each value of the list 'til 5' has been applied to the function once.
Map iterators in detail: