From 71fe1304daa95e7579ee7f5b26d1d30f4dea8607 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Sun, 7 Aug 2022 23:08:26 -0500 Subject: [PATCH] extra: use push-at-each --- extra/assocs/extras/extras.factor | 8 ++++---- extra/lint/lint.factor | 2 +- extra/sequences/abbrev/abbrev.factor | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/extra/assocs/extras/extras.factor b/extra/assocs/extras/extras.factor index 3425b13388..98f9ebbb3e 100644 --- a/extra/assocs/extras/extras.factor +++ b/extra/assocs/extras/extras.factor @@ -4,6 +4,9 @@ USING: arrays assocs assocs.private kernel math math.statistics sequences sets ; IN: assocs.extras +: push-at-each ( value keys assoc -- ) + '[ _ push-at ] with each ; inline + : deep-at ( assoc seq -- value/f ) [ of ] each ; inline @@ -148,7 +151,7 @@ PRIVATE> : expand-keys-push-at-as ( assoc exemplar -- hashtable' ) [ [ swap dup sequence? [ 1array ] unless ] - [ '[ _ push-at ] with each ] + [ push-at-each ] ] dip assoc>object ; : expand-keys-push-at ( assoc -- hashtable' ) @@ -235,9 +238,6 @@ PRIVATE> [ neg swap pick at+ ] assoc-each [ 0 > ] filter-values ; -: push-at-each ( value keys assoc -- ) - '[ _ push-at ] with each ; inline - : collect-by-multi! ( ... assoc seq quot: ( ... obj -- ... key ) -- ... assoc ) [ keep swap ] curry rot [ [ push-at-each ] curry compose each diff --git a/extra/lint/lint.factor b/extra/lint/lint.factor index 7f925fa9be..42639ce893 100644 --- a/extra/lint/lint.factor +++ b/extra/lint/lint.factor @@ -219,7 +219,7 @@ CONSTANT: trivial-defs [ { [ callable? ] [ ignore-def? not ] } 1&& ] deep-filter ; : (load-definitions) ( word def hash -- ) - [ all-callables ] dip '[ _ push-at ] with each ; + [ all-callables ] dip push-at-each ; : load-definitions ( words -- hash ) H{ } clone [ '[ dup def>> _ (load-definitions) ] each ] keep ; diff --git a/extra/sequences/abbrev/abbrev.factor b/extra/sequences/abbrev/abbrev.factor index 8cde6f42e5..0c5640f2ed 100644 --- a/extra/sequences/abbrev/abbrev.factor +++ b/extra/sequences/abbrev/abbrev.factor @@ -1,6 +1,6 @@ ! Copyright (C) 2009 Maximilian Lupke. ! See http://factorcode.org/license.txt for BSD license. -USING: assocs kernel ranges sequences ; +USING: assocs assocs.extras kernel ranges sequences ; IN: sequences.abbrev : abbrev ( seqs -- assoc ) H{ } clone [ - '[ dup prefixes [ _ push-at ] with each ] each + swap [ dup prefixes rot push-at-each ] with each ] keep ; : unique-abbrev ( seqs -- assoc ) -- 2.34.1