how namespace .u is defined?

kdb-tick example tick.q is using .u.d, but I cannot find that function along with many other “global used” functions.  Anyone know how they are defined?

 globals used

 .u.w - dictionary of tables->(handle;syms) -> this is OK, from .u.init()

 .u.i - msg count in log file -> how is it defined?

 .u.j - total msg count (log file plus those held in buffer)  -> how is it defined?

 .u.t - table names -> this is OK, from .u.init()

 .u.L - tp log filename, e.g. `:./sym2008.09.11 -> how is it defined?

 .u.l - handle to tp log file -> how is it defined?

 .u.d - date -> how is it definded?

https://github.com/KxSystems/kdb-tick/blob/afc67eda6dfbb2ca89322f702db23ee68c2c7be3/tick.q#L58

they’re defined in the same file, except for .u.w and .u.t which are in tick/u.q. 

They’re set by assigning to globals using the “::” operator. e.g. to find .u.L search tick.q for “L::” and you’ll find it being set in ld and tick.

Hi George, thank you. i found this out yesterday, the code wasn’t executed due to an error on  'timesym</u> What does it mean for **<u>'</u>** before **timesym**? 

q)'timesym 'timesym &nbsp; [0] &nbsp;'timesym

tick:{init;if[not min(timesym~2#key flip value@)each t;'timesym</span></u>];@[;sym;g#]each t;d::.z.D;if[l::count y;L::$“:”,y,“/”,x,10#“.”;l::ld d]};  

Hi George, thank you. i found this out yesterday, the code wasn’t fully run due to an error on  '`timesym

What does it mean for  '  before  `timesym

q)'timesym 'timesym &nbsp; [0] &nbsp;'timesym

tick:{init;if[not min(timesym~2#key flip value@)each t;'timesym</u>];@[;sym;g#]each t;d::.z.D;if[l::count y;L::$“:”,y,“/”,x,10#“.”;l::ld d]};

Hi, in response to your question. The .u namespace functions listed are defined between the two functions .u.tick and .u.ld inside the tick.q file. They are defined as global variables within these functions, which can be seen by the use of the double :: instead of the single : used for assign. And since we are inside the .u namespace when these globals are being defined, they take the prefix of .u before their name. We are put into the .u namespace by the line \d .u . In relation to where they are actually defined, in the .u.tick function:

tick:{init;if[not min(timesym~2#key flip value@)each t;'timesym];@[;sym;g#]each t;d::.z.D;if[l::count y;L::$“:”,y,“/”,x,10#“.”;l::ld d]};
We see that .u.d is defined as .z.D  and .u.l as .u.ld d (opens up a handle for the logfile corresponding to date d). Furthermore, .u.L is also defined here, as `$“:”,y,“/”,x,10#“.” . Where x is the name of the table schema and y is directory where the log file is created. Inside the .u.ld function, we see the others being defined:

ld:{if[not type key L::`$(-10_string L),string x;.[L;();:;()]];i::j::-11!(-2;L);if[0<=type i;-2 (string L)," is a corrupt log. Truncate to length “,(string last i),” and restart";exit 1];hopen L};
Both .u.i and .u.j are similarly defined as -11!(-2;L) . .u.i is updated by either .u.upd  or .z.ts depending on the TP mode. And .u.j is later updated by .u.upd when running in batch mode.

With regard to the timesym part of the code. The TP requires the first two columns of the table schema to be time and sym, if this is not the case, then the error timesym is returned. The apostrophe is used for signalling errors (for debugging purposes). You can explore more about this at the following page:

https://code.kx.com/q/ref/signal/ 

Hope this helps,
Matthew 

thank you Matthew.  Yes i found that ’ is Signal while reading the If control page just now.

Very appreciated your time to help me understand the code in plain language.