Can someone just post an example of function s with datatype 100 (lambda) and 112 (dynamic queries). Also since kdb has a new data type 20 (`sym) does that mean that every other data type got shifted doen by 1 or is it eating a number from the enumeration data type range Lastly, nested types are described to be 77 till 97. What is an example of a nested type ?
Check this page: http://code.kx.com/wiki/Reference/Datatypes
It has examples for all.
It does not have examples to any of those questions
Yes it does.
Function Types
| num | type/example |
| 100 | lambda |
| 101 | unary primitive |
| 102 | binary primitive |
| 103 | ternary (operator) |
| 104 | projection |
| 105 | composition |
| 106 | f’ |
| 107 | f/ |
| 108 | f\ |
| 109 | f’: |
| 110 | f/: |
| 111 | f: |
| 112 | dynamic load |
For example:
q)type each({x+y};neg;-;\;+[;1];<>;,';+/;+\;prev;+/:;+\:;`f 2:`f,1)100 101 102 103 104 105 106 107 108 109 110 111 112h
100:
{x+y}
112:
`f 2:`f,1
Type 20 is not a new datatype.
Nested types are nested vectors (i.e. lists of lists) that are mapped from disk.
q)`:floats set (1 2 3f;2 3 4f) //list of lists of floats
`:floats
q)type get `:floats
86h
q)`:ints set (1 2 3i;2 3 4i) //list of lists of ints
`:ints
q)type get `:ints
83h
Again, this is described in the wiki page. The result of “type” is 77 + primitive type. So nested floats are 77+9=86, ints are 77+6=83 etc:
Nested Types
These types are used for mapped lists of lists of the same type. The numbering is 77 + primitive type (e.g. 78 is boolean, 96 is time and 97 is `sym$ enumeration.) For example:
q)`:t1.dat set 2 3#til 6`:t1.datq)a:get `:t1.datq)type a / integer nested type83hq)a0 1 23 4 5
I’d recommend fully reading the documentation before asking any questions as the answers are likely in there.
Thanks
Tom