diff --git a/extra/assocs/lib/lib.factor b/extra/assocs/lib/lib.factor index 0181514ab4..50da66e669 100644 --- a/extra/assocs/lib/lib.factor +++ b/extra/assocs/lib/lib.factor @@ -11,14 +11,17 @@ IN: assocs.lib ! set-hash with alternative stack effects -: put-hash* ( table key value -- ) swap rot set-at ; +: put-hash* ( table key value -- ) spin set-at ; : put-hash ( table key value -- table ) swap pick set-at ; ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! : set-hash-stack ( value key seq -- ) - dupd [ key? ] when find-last nip set-at ; + dupd [ key? ] with find-last nip set-at ; : at-default ( key assoc -- value/key ) dupd at [ nip ] when* ; + +: at-peek ( key assoc -- value ? ) + at* dup >r [ peek ] when r> ; diff --git a/extra/automata/ui/ui.factor b/extra/automata/ui/ui.factor index 5cf9ccc71f..ab424cdab6 100644 --- a/extra/automata/ui/ui.factor +++ b/extra/automata/ui/ui.factor @@ -14,7 +14,7 @@ USING: kernel namespaces math quotations arrays hashtables sequences threads ui.gadgets.packs ui.gadgets.grids ui.gadgets.theme - namespaces.lib hashtables.lib vars + namespaces.lib assocs.lib vars rewrite-closures automata ; IN: automata.ui @@ -85,4 +85,4 @@ over @center grid-add : automata-window ( -- ) [ [ automata-window* ] with-scope ] with-ui ; -MAIN: automata-window \ No newline at end of file +MAIN: automata-window diff --git a/extra/boids/ui/ui.factor b/extra/boids/ui/ui.factor index 235ccc3914..6d04a4d623 100644 --- a/extra/boids/ui/ui.factor +++ b/extra/boids/ui/ui.factor @@ -20,7 +20,7 @@ USING: kernel namespaces ui.gadgets.grids ui.gestures combinators.cleave - hashtables.lib vars rewrite-closures boids ; + assocs.lib vars rewrite-closures boids ; IN: boids.ui @@ -163,4 +163,4 @@ VARS: population-label cohesion-label alignment-label separation-label ; : boids-window ( -- ) [ [ boids-window* ] with-scope ] with-ui ; -MAIN: boids-window \ No newline at end of file +MAIN: boids-window diff --git a/extra/namespaces/lib/lib.factor b/extra/namespaces/lib/lib.factor index 79a4855c04..6e66119cb0 100644 --- a/extra/namespaces/lib/lib.factor +++ b/extra/namespaces/lib/lib.factor @@ -1,8 +1,8 @@ -! USING: kernel quotations namespaces sequences hashtables.lib ; +! USING: kernel quotations namespaces sequences assocs.lib ; USING: kernel namespaces namespaces.private quotations sequences - hashtables.lib ; + assocs.lib ; IN: namespaces.lib @@ -16,4 +16,4 @@ IN: namespaces.lib ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -: set* ( val var -- ) namestack* set-hash-stack ; \ No newline at end of file +: set* ( val var -- ) namestack* set-hash-stack ;