3 ms·
Small correction: I forgot to sort the indicies by first appearance to guarantee by-order-of-appearance, so this should be {x@{x@<x}*:'.=x} where I've added "{x
by beagle3 7y ago
Small correction: I forgot to sort the indicies by first appearance to guarantee by-order-of-appearance, so this should be {x@{x@<x}*:'.=x} where I've added "{x@<x}" - sort ("x at grade x"). Inner x and outer x are not the same one, this is an implicit argument; you can extract it out to a named function or name the argument e.g. {[v]v@<v} -- and I encourage you to do both when you start. But over time, "{x@<x}" becomes its own object, in the way that the word "while" is its own word and not the 5 letters that make it.