如何将零排序到列表末尾。我尝试使用 idesc 函数对所有元素进行排序,但我想要稳定的列表排序,预期结果是 2 4 3 2 0 0。请帮助解决这个问题。
/this is not giving expected result, it is sorting all elements.
q)list:2 4 3 0 2 0
q)list (idesc list)
4 3 2 2 0 0
/Another option, Is there any better solution to optimize below function.
q){(x where x<>0), x where x=0}[list]
2 4 3 2 0 0
您的尝试很接近,在这种情况下,最好使用
idesc/iasc
布尔值重新排序