Basic (but still intriguing to me) q Interpreter question

https://learninghub.kx.com/forums/topic/basic-but-still-intriguing-to-me-q-interpreter-question

A bit at lost here… Can someone enlighten me as to how the interpreter works in the following situation:

q)show a:10?(-1 0 1) //Just to have something
0 1 1 0 -1 0 1 -1 0 0

q)(>)a //That’s the curiosity
1 2 6 0 3 5 8 9 4 7

I understand this is actually the same as…

q)raze where each a=/:desc distinct a
1 2 6 0 3 5 8 9 4 7

but… can’t figure out where this is coming from(!)

Thx in advance

 

Hi JP, this is just the underlying k implementation of idesc: https://code.kx.com/q/ref/desc/#idesc

 

q)a:0 1 1 0 -1 0 1 -1 0 0 
q)idesc 
k){$[0h>@x;'`rank;>x]} 
q)idesc[a]~(>)a 
1b 
q) >a 
1 2 6 0 3 5 8 9 4 7

 

The brackets allow q to interpret this, but the use is discouraged (https://code.kx.com/q/basics/exposed-infrastructure/#unary-forms). Rather use the idesc keyword instead.

Feel ashamed(!)… I realize I shouldn’t have skipped that part of the language:-)

Thx again