From 4da798920eff16bc07458345227354454ad4c0c7 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Fri, 8 Mar 2013 18:08:09 -0800 Subject: [PATCH] Revert "graphs: change closure to use a set and operate on sequences." This reverts commit 2cc201a38ac6110f0b8c9c86f4cb34c1fde43c0f. --- core/classes/classes.factor | 8 +++----- core/classes/tuple/tuple.factor | 2 +- core/graphs/graphs-docs.factor | 5 ++--- core/graphs/graphs-tests.factor | 3 +-- core/graphs/graphs.factor | 15 +++++++++------ 5 files changed, 16 insertions(+), 17 deletions(-) diff --git a/core/classes/classes.factor b/core/classes/classes.factor index cdc34d1276..6970f88767 100644 --- a/core/classes/classes.factor +++ b/core/classes/classes.factor @@ -130,11 +130,9 @@ GENERIC: implementors ( class/classes -- seq ) tri ] { } make ; -: class-usage ( class -- seq ) - update-map get at keys ; +: class-usage ( class -- seq ) update-map get at ; -: class-usages ( class -- seq ) - [ class-usage ] closure sets:members ; +: class-usages ( class -- seq ) [ class-usage ] closure keys ; M: class implementors implementors-map get at sets:members ; @@ -172,7 +170,7 @@ GENERIC: metaclass-changed ( use class -- ) : check-metaclass ( class metaclass -- usages/f ) over class? [ over "metaclass" word-prop eq? - [ drop f ] [ class-usage ] if + [ drop f ] [ class-usage keys ] if ] [ 2drop f ] if ; : ?define-symbol ( word -- ) diff --git a/core/classes/tuple/tuple.factor b/core/classes/tuple/tuple.factor index 895302eaa3..18a44409a5 100644 --- a/core/classes/tuple/tuple.factor +++ b/core/classes/tuple/tuple.factor @@ -298,7 +298,7 @@ PRIVATE> GENERIC: make-final ( class -- ) M: tuple-class make-final - [ dup class-usage ?metaclass-changed ] + [ dup class-usage keys ?metaclass-changed ] [ t "final" set-word-prop ] bi ; diff --git a/core/graphs/graphs-docs.factor b/core/graphs/graphs-docs.factor index 7b6d20e7ba..a08a2a5bf9 100644 --- a/core/graphs/graphs-docs.factor +++ b/core/graphs/graphs-docs.factor @@ -1,5 +1,4 @@ -USING: assocs hashtables help.markup help.syntax kernel -sequences sets ; +USING: assocs hashtables help.markup help.syntax kernel sequences ; IN: graphs ARTICLE: "graphs" "Directed graph utilities" @@ -29,5 +28,5 @@ HELP: remove-vertex { $side-effects "graph" } ; HELP: closure -{ $values { "obj" object } { "quot" { $quotation "( obj -- assoc )" } } { "set" set } } +{ $values { "obj" object } { "quot" { $quotation "( obj -- assoc )" } } { "assoc" "a new assoc" } } { $description "Outputs a set of all vertices reachable from " { $snippet "vertex" } " via edges given by the quotation. The set always includes " { $snippet "vertex" } "." } ; diff --git a/core/graphs/graphs-tests.factor b/core/graphs/graphs-tests.factor index 57424472e5..90b0e93b7c 100644 --- a/core/graphs/graphs-tests.factor +++ b/core/graphs/graphs-tests.factor @@ -1,5 +1,4 @@ USING: graphs tools.test namespaces kernel sorting assocs ; -FROM: sets => members ; H{ } "g" set { 1 2 3 } "v" set @@ -15,7 +14,7 @@ H{ } "g" set [ { 2 3 4 5 } ] [ - 2 [ "g" get at keys ] closure members natural-sort + 2 [ "g" get at ] closure keys natural-sort ] unit-test H{ } "g" set diff --git a/core/graphs/graphs.factor b/core/graphs/graphs.factor index 29f38fc53a..eed2a69c33 100644 --- a/core/graphs/graphs.factor +++ b/core/graphs/graphs.factor @@ -31,12 +31,15 @@ PRIVATE> -: closure ( obj quot -- set ) - HS{ } clone [ swap (closure) ] keep ; inline +: closure ( obj quot -- assoc ) + H{ } clone [ swap (closure) ] keep ; inline