http://nsl.com/papers/order.htm
order:{?|,/(?,/x@)\y}
/ d:c+b
/ c:-b
/ e:d*a
/ b:10
/ a:20
s.d:c
b
s.c:,b s.e:
da s.b:0#
s.a:0#`
order[s;!s]
http://nsl.com/papers/order.htm
order:{?|,/(?,/x@)\y}
/ d:c+b
/ c:-b
/ e:d*a
/ b:10
/ a:20
s.d:c
b
s.c:,b s.e:
da s.b:0#
s.a:0#`
order[s;!s]
Nice problem - thanks Stevan for the solution.
Here’s a q port:
s:p
oq
nm!(
on;
n;p
m;;
)
order: {distinct reverse raze (raze x@) scan key x}
order[s]