Using K?

I have a few questions about using K (not q) in kdb+.

Firstly, I know that you can use a slash to go to K mode in the interactive interpreter:

ryan@DevPC-LX:~$ q

KDB+ 3.2 2015.03.04 Copyright (C) 1993-2015 Kx Systems

l32/ 4()core 5862MB ryan devpc-lx 127.0.1.1 NONEXPIRE  

Welcome to kdb+ 32bit edition

For support please see http://groups.google.com/d/forum/personal-kdbplus

Tutorials can be found at http://code.kx.com/wiki/Tutorials

To exit, type \

To remove this startup msg, edit q.q

q)9#!4

'!

q)\

  9#!4

0 1 2 3 0 1 2 3 0

  

How do a run a K script? Putting a slash at the top does nothing. I thought:

$ q x.k

would automatically use K because of the file extension…but it doesn’t.

Also, is it possible to access a kdb+ database from K, *not* q?

Ryan

[ERROR]: Your autotools build scripts are 200 lines longer than your program. Something’s wrong.

http://kirbyfan64.github.io/
 

Hi,

  kdb understands the .k extension and reads it as K code (many Q functions are implemented in the file q.k):

$ echo ‘9#!4’ > ./q/a.k

$ ./q.sh

KDB+ 3.2 2015.04.23 Copyright (C) 1993-2015 Kx Systems

m32/ 8()core 10240MB trodrigues tiagos-macbook-pro.local 172.20.10.2 NONEXPIRE  

Welcome to kdb+ 32bit edition

For support please see http://groups.google.com/d/forum/personal-kdbplus

Tutorials can be found at http://code.kx.com/wiki/Tutorials

To exit, type \

To remove this startup msg, edit q.q

q) \l a.k

0 1 2 3 0 1 2 3 0

You can also define K functions in Q (or in a Q script) if you precede it by k) :

q)k)9#!4

0 1 2 3 0 1 2 3 0

Note: you can’t mix K and Q code on the same function

Regarding the database, you can, since tables in Q are a flipped dictionary (take a look at q.k). But why would you not use Q for that?

Hope it helps

On June 2, 2015 2:19:01 PM CDT, Tiago Rodrigues wrote:

>Hi,

>

>kdb understands the .k extension and reads it as K code (many Q

>functions

>are implemented in the file q.k):

>

>$ echo ‘9#!4’ > ./q/a.k

>

>$ ./q.sh

>

>KDB+ 3.2 2015.04.23 Copyright (C) 1993-2015 Kx Systems

>

>m32/ 8()core 10240MB trodrigues tiagos-macbook-pro.local 172.20.10.2

>NONEXPIRE

>

>

>Welcome to kdb+ 32bit edition

>

>For support please see

>http://groups.google.com/d/forum/personal-kdbplus

>

>Tutorials can be found at http://code.kx.com/wiki/Tutorials

>

>To exit, type

>

>To remove this startup msg, edit q.q

>

>q)l a.k

>

>0 1 2 3 0 1 2 3 0



But can I launch it from the command-line?



>

>You can also define K functions in Q (or in a Q script) if you precede

>it

>by k) :

>

>q)k)9#!4

>

>0 1 2 3 0 1 2 3 0

>

>

>Note: you can’t mix K and Q code on the same function

>

>Regarding the database, you can, since tables in Q are a flipped

>dictionary

>(take a look at q.k). But why would you not use Q for that?



Just a little experiment…I kind of like k a little better than q. I prefer typing short operators.



>

>Hope it helps

>

>On Tuesday, 2 June 2015 19:17:09 UTC+1, Ryan Gonzalez wrote:

>>

>> I have a few questions about using K (not q) in kdb+.

>>

>> Firstly, I know that you can use a slash to go to K mode in the

>> interactive interpreter:

>>

>> ryan@DevPC-LX:~$ q

>> KDB+ 3.2 2015.03.04 Copyright (C) 1993-2015 Kx Systems

>> l32/ 4()core 5862MB ryan devpc-lx 127.0.1.1 NONEXPIRE

>>

>> Welcome to kdb+ 32bit edition

>> For support please see

>http://groups.google.com/d/forum/personal-kdbplus

>> Tutorials can be found at http://code.kx.com/wiki/Tutorials

>> To exit, type

>> To remove this startup msg, edit q.q

>> q)9#!4

>> '!

>> q)

>> 9#!4

>> 0 1 2 3 0 1 2 3 0

>>

>> How do a run a K script? Putting a slash at the top does nothing. I

>> thought:

>>

>> $ q x.k

>>

>> would automatically use K because of the file extension…but it

>doesn’t.

>>

>> Also, is it possible to access a kdb+ database from K, not q?

>>

>> –

>> Ryan

>> [ERROR]: Your autotools build scripts are 200 lines longer than your

>> program. Something’s wrong.

>> http://kirbyfan64.github.io/

>>

>>





Sent from my Android device with K-9 Mail. Please excuse my brevity.

q a.k

should work fine