cancel
Showing results for 
Search instead for 
Did you mean: 

Dot amend and q.k query.

kdb_queries
New Contributor
Hi Friends,

I have 2 question:

  • I am not able to get what does the second parameter in dot amend signify.
    .[`:t;();:;t]
    Please give me link if there is any docs for this.
  • Is q.k file is used to map between k and q and from where can i load and see this file.

Thanks in Advance
Rajesh
2 REPLIES 2

manni_patel
New Contributor
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)