qs=: 3 : 0
if. (#y)<:1 do. y
else.
  h =. {.y NB. head
  t =. }.y NB. tail
  l =. (th)#t
  (qs l),m,h,qs g
end.
)

NB. one-liner
qs=: 3 : 'if. 1>:#y do. y else. (qs(th=.{.y)#t=.}.y end.'

NB. leave h in array
qs=: 3 : 'if. 1>:#y do. y else. (qs(yh=.{.y)#y end.'

NB. with separate helper function
qF=: 4 : '(qs(xy)#x'
qF=: ([: qs <#[),(=#[),[: qs >#[   NB. tacit of above (result of 13 : '...')
qF=: (qs@(<#])),(=#]),qs@(>#])     NB. same
qs=: 3 : 'if. 1>:#y do. y else. y qF {.y end.'
qs=: ] ` (]qF{.) @. (1<#)  NB. tacit of above

NB. with adverb
qA=: 1 : '] #~ ] x {.'
qs=: ] ` ($:@(qA)) @. (1<#)

NB. final tacit
qs=: ]`({.(([:$:>#]),(=#]),[:$:<#])])@.(1<#)

NB. test it
  sorted =: [: *./ 2 <:/\ ]
  sorted a=:?20#10
0
  sorted qs a
1