! See http://factorcode.org/license.txt for BSD license.
USING: accessors arrays kernel continuations assocs namespaces
sequences words vocabs definitions hashtables init sets
-math.order classes classes.algebra ;
+math math.order classes classes.algebra ;
IN: compiler.units
SYMBOL: old-definitions
SYMBOL: outdated-tuples
SYMBOL: update-tuples-hook
+: dependency>= ( how1 how2 -- ? )
+ [
+ {
+ called-dependency
+ flushed-dependency
+ inlined-dependency
+ } index
+ ] bi@ >= ;
+
: strongest-dependency ( how1 how2 -- how )
- [ called-dependency or ] bi@ max ;
+ [ called-dependency or ] bi@ [ dependency>= ] most ;
: weakest-dependency ( how1 how2 -- how )
- [ inlined-dependency or ] bi@ min ;
+ [ inlined-dependency or ] bi@ [ dependency>= not ] most ;
: compiled-usage ( word -- assoc )
compiled-crossref get at ;
#! don't have to recompile words that folded this away.
[ compiled-usage ]
[ "flushable" word-prop inlined-dependency flushed-dependency ? ] bi
- [ after=? nip ] curry assoc-filter ;
+ [ dependency>= nip ] curry assoc-filter ;
: compiled-usages ( assoc -- assocs )
[ drop word? ] assoc-filter
ERROR: no-compilation-unit definition ;
-SINGLETON: inlined-dependency
-SINGLETON: flushed-dependency
-SINGLETON: called-dependency
-
-UNION: dependency
-inlined-dependency
-flushed-dependency
-called-dependency ;
-
-M: dependency <=>
- [
- {
- called-dependency
- flushed-dependency
- inlined-dependency
- } index
- ] bi@ <=> ;
+SYMBOL: inlined-dependency
+SYMBOL: flushed-dependency
+SYMBOL: called-dependency
SYMBOL: changed-definitions
USING: sorting sequences kernel math math.order random
-tools.test vectors sets ;
+tools.test vectors sets vocabs ;
IN: sorting.tests
[ { } ] [ { } natural-sort ] unit-test
[ { { 1 "a" } { 1 "b" } { 1 "c" } { 1 "e" } { 2 "d" } } ]
[ { { 1 "a" } { 1 "b" } { 1 "c" } { 2 "d" } { 1 "e" } } sort-keys ] unit-test
+
+[ ] [ all-words natural-sort drop ] unit-test