! Copyright (C) 2011 Jon Harper. ! See http://factorcode.org/license.txt for BSD license. USING: combinators.short-circuit.smart fry kernel macros math.order sequences sorting ; IN: rien MACRO: first-true-quot-idx ( quots -- idx ) [ [ and ] curry compose ] map-index [ || ] curry ; : sort-args ( els quots -- els ) '[ [ _ first-true-quot-idx ] bi@ <=> ] sort ; inline