Amend: http://code.kx.com/wiki/JB:QforMortals2/functions#Functional_Forms_of_Amend
q.k should be next to your binary. It defines a lot of the functions you’d use in q, and the other other namespaces (e.g. .Q)
The topic of functional amends is quite complex and I don’t think that section of Q for Mortals covers the case Rajesh asked about.
The most thorough explanation I found of functional amends can be found on kdbfaq.com (http://www.kdbfaq.com/kdb-faq/how-do-i-use-the-functional-forms-of-apply-and-amend.html).
.[t;();f;d]
When you pass () as the second argument to dot amend it means that the whole first argument of dot amend t is passed to function f in single invocation.
q)m:3 3#til 9
q)m
0 1 2
3 4 5
6 7 8
q).[m;();{[x;y]y};6]
6
Compared to the case when the whole matrix m is passed, but using eliding indices with ::, function f is called for each element of m matrix.
q).[m;(::;::);{[x;y]y};6]
6 6 6
6 6 6
6 6 6
Location of q.k file is usually indicated by QHOME environment variable, if it doesn’t exist q.k should be in default location: $HOME/q for Linux or c:\q for Windows.
HTH,
Pawel
2013/10/27 Manish Patel <manni.patel@gmail.com>
Amend: http://code.kx.com/wiki/JB:QforMortals2/functions#Functional_Forms_of_Amend
q.k should be next to your binary. It defines a lot of the functions you’d use in q, and the other other namespaces (e.g. .Q)