.u.init in tick/u.q

304 views
Skip to first unread message

analyst

unread,
Nov 5, 2015, 5:18:30 PM11/5/15
to Kdb+ Personal Developers
I don't understand how .u.init function works in tick/u.q. Can someone explain how it works ?

What is w ? I thought x y and z would be implicit function arguments ?

Are there 2 functions declared on line 6 ? The two functions are del and .z.pc ? If there are 2 funxtions declared then where is the semi-colon coming from ?

Marcus Clarke

unread,
Nov 6, 2015, 12:56:54 AM11/6/15
to personal...@googlegroups.com
Hi,

.u.init does two things for you, 1. It defines .u.t to be your list of tables in the TP process and 2. It defines .u.w as a dictionary of handles for each table in .u.t.

This function (.u.init) doesn't have any input parameters hence the reason it doesn't reference x, y or z. But you are correct in saying that normally X, y and z are arguments which can be used without having to explicitly declare them at the start of a function. 

del and .z.pc are two separately declared functions, the semi-colon does this separating. In theory it's possible to declare lots of functions or variables on the same line by separating with a semi-colon but that would just leave it hard to read.

Also worth noting that when u.q will move you into the .u namespace using the line "\d .u" therefore eventhough you then define w or t you can reference them from the root namespace as .u.w and .u.t.

Hope this helps


Sent from Mailbox


--
You received this message because you are subscribed to the Google Groups "Kdb+ Personal Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to personal-kdbpl...@googlegroups.com.
To post to this group, send email to personal...@googlegroups.com.
Visit this group at http://groups.google.com/group/personal-kdbplus.
For more options, visit https://groups.google.com/d/optout.


Kim Tang

unread,
Nov 8, 2015, 6:41:50 AM11/8/15
to personal...@googlegroups.com

>>> I don't understand how .u.init function works in tick/u.q. Can someone explain how it works ?
u.q is only a part of the whole tick system. To understand it you also need to study tick.q and r.q.

To start the tick system, here are some examples:

/test
>q tick.q
>q tick/ssl.q

/run
>q tick.q sym . -p 5010 /tick
>q tick/r.q :5010 -p 5011 /rdb
>q sym -p 5012 /hdb
>q tick/ssl.q sym :5010 /feed

>>> What is w ? I thought x y and z would be implicit function arguments ?
These are described in tick.q:
\
globals used
.u.w - dictionary of tables->(handle;syms)
.u.i - msg count in log file
.u.j - total msg count (log file plus those held in buffer)
.u.t - table names
.u.L - tp log filename, e.g. `:./sym2008.09.11
.u.l - handle to tp log file
.u.d - date

>>> Are there 2 functions declared on line 6 ? The two functions are del and .z.pc ? If there are 2 funxtions declared then where is the semi-colon coming from ?

Yes 2 functions are defined and the semicolon is here:
del:{w[x]_:w[x;;0]?y} ; .z.pc:{del[;x]each t};

Btw: FD has a reference manual : http://www.kx.com/q/d/FD_kdb+_reference_manual_3.0.doc
Perhaps this will help you.

Kim

-----Ursprüngliche Nachricht-----
Von: personal...@googlegroups.com [mailto:personal...@googlegroups.com] Im Auftrag von analyst
Gesendet: Freitag, 6. November 2015 06:06
An: Kdb+ Personal Developers
Betreff: [personal kdb+] .u.init in tick/u.q

I don't understand how .u.init function works in tick/u.q. Can someone explain how it works ?

What is w ? I thought x y and z would be implicit function arguments ?

Are there 2 functions declared on line 6 ? The two functions are del and .z.pc ? If there are 2 funxtions declared then where is the semi-colon coming from ?

Reply all
Reply to author
Forward
0 new messages