diff --git a/core/hashtables/hashtables-docs.factor b/core/hashtables/hashtables-docs.factor index d4aee1af64..5ed8fbbe3a 100644 --- a/core/hashtables/hashtables-docs.factor +++ b/core/hashtables/hashtables-docs.factor @@ -70,7 +70,7 @@ HELP: nth-pair { nth-pair set-nth-pair } related-words HELP: set-nth-pair -{ $values { "value" "the second element of the pair" } { "key" "the first element of the pair" } { "n" "an index in the sequence" } { "seq" "a sequence" } } +{ $values { "value" "the second element of the pair" } { "key" "the first element of the pair" } { "seq" "a sequence" } { "n" "an index in the sequence" } } { $description "Stores a pair of values into the elements with index " { $snippet "n" } " and " { $snippet "n+1" } ", respectively." } { $warning "This word is in the " { $vocab-link "hashtables.private" } " vocabulary because it does not perform bounds checks." } { $side-effects "seq" } ; diff --git a/core/hashtables/hashtables.factor b/core/hashtables/hashtables.factor index 3050ed2bcf..4761dcd88f 100644 --- a/core/hashtables/hashtables.factor +++ b/core/hashtables/hashtables.factor @@ -59,8 +59,7 @@ IN: hashtables swap 2 fixnum+fast 2dup slot -rot 1 fixnum+fast slot ; inline -: set-nth-pair ( value key n seq -- ) - swap +: set-nth-pair ( value key seq n -- ) 2 fixnum+fast [ set-slot ] 2keep 1 fixnum+fast set-slot ; inline @@ -73,7 +72,7 @@ IN: hashtables : (set-hash) ( value key hash -- ) 2dup new-key@ [ rot hash-count+ ] [ rot drop ] if - swap set-nth-pair ; inline + set-nth-pair ; inline : find-pair-next >r 2 fixnum+fast r> ; inline @@ -133,7 +132,7 @@ M: hashtable clear-assoc ( hash -- ) M: hashtable delete-at ( key hash -- ) tuck key@ [ - >r >r ((tombstone)) dup r> r> swap set-nth-pair + >r >r ((tombstone)) dup r> r> set-nth-pair hash-deleted+ ] [ 3drop