egor7
egor7

Reputation: 4940

.Q.trp and bt handling

I saw (in .Q.fpn) the following technique to parse and show the bt object passed to .Q.trp function:

q)f:{x+1}
q).Q.trp[f;`a;{'(x;y)}]
'type
  [4]  f:{x+1}
           ^
  [3]  (.Q.trp)

  [2]  .Q.trp[f;`a;{'(x;y)}]
       ^
  [0]  .Q.trp[f;`a;{'(x;y)}]
       ^

'(x;y) seems like an exception building construction, - but Kx documentation says that there are only two ways of exception building: from symbol and from string. It is looks like we can built an exception from a list of (symbol; bt object).

So what the construction '(x;y) stands for?

Can we build something different than exception with '(x;y)?

Upvotes: 2

Views: 545

Answers (1)

terrylynch
terrylynch

Reputation: 13657

My guess is that this is a specific signal recently allowed along with the addition of the .Q.trp/.Q.bt functionality. It looks like it works only for (symbol;bt object) or (string;bt object), anything else is unrecognized.

q).Q.trp[{1+x};`a;{'(x;y;1)}]
'stype

The output can be stored if returned without the signal:

q)r:.Q.trp[{1+x};`a;{(x;y)}]

and this type of signal seems to work in any context, not just within .Q.trp:

q)'("other";last r)
'other
  [2]  {1+x}
         ^
  [1]  (.Q.trp)

  [0]  r:.Q.trp[{1+x};`a;{(x;y)}]

I suspect the last r has a very specific format/shape that one could fabricate but it seems like an unnecessary use-case.

Bonus oddities:

This works:

q)'("other";())
'other
  [0]  '("other";())
        ^

but other things I've tried show up weird errors:

q)'("other";(();()))
pl0
pl0
q)
q)'("other";"abc")
srr

Upvotes: 2

Related Questions