graphs: move some words to private.
parent
9eaf91de16
commit
0b8aa8efe0
|
@ -3,12 +3,16 @@
|
||||||
USING: assocs kernel namespaces sequences sets ;
|
USING: assocs kernel namespaces sequences sets ;
|
||||||
IN: graphs
|
IN: graphs
|
||||||
|
|
||||||
|
<PRIVATE
|
||||||
|
|
||||||
: if-graph ( vertex edges graph quot -- )
|
: if-graph ( vertex edges graph quot -- )
|
||||||
dupd [ 3drop ] if ; inline
|
dupd [ 3drop ] if ; inline
|
||||||
|
|
||||||
: nest ( key graph -- hash )
|
: nest ( key graph -- hash )
|
||||||
[ drop H{ } clone ] cache ; inline
|
[ drop H{ } clone ] cache ; inline
|
||||||
|
|
||||||
|
PRIVATE>
|
||||||
|
|
||||||
: add-vertex ( vertex edges graph -- )
|
: add-vertex ( vertex edges graph -- )
|
||||||
[ [ nest dupd set-at ] curry with each ] if-graph ; inline
|
[ [ nest dupd set-at ] curry with each ] if-graph ; inline
|
||||||
|
|
||||||
|
@ -25,6 +29,8 @@ IN: graphs
|
||||||
swapd [ [ rot ] dip at delete-at drop ] 2curry assoc-each
|
swapd [ [ rot ] dip at delete-at drop ] 2curry assoc-each
|
||||||
] if-graph ; inline
|
] if-graph ; inline
|
||||||
|
|
||||||
|
<PRIVATE
|
||||||
|
|
||||||
: (closure) ( obj assoc quot: ( elt -- assoc ) -- )
|
: (closure) ( obj assoc quot: ( elt -- assoc ) -- )
|
||||||
2over key? [
|
2over key? [
|
||||||
3drop
|
3drop
|
||||||
|
@ -33,5 +39,7 @@ IN: graphs
|
||||||
[ [ drop ] 3dip (closure) ] 2curry assoc-each
|
[ [ drop ] 3dip (closure) ] 2curry assoc-each
|
||||||
] if ; inline recursive
|
] if ; inline recursive
|
||||||
|
|
||||||
|
PRIVATE>
|
||||||
|
|
||||||
: closure ( obj quot -- assoc )
|
: closure ( obj quot -- assoc )
|
||||||
H{ } clone [ swap (closure) ] keep ; inline
|
H{ } clone [ swap (closure) ] keep ; inline
|
||||||
|
|
Loading…
Reference in New Issue