From: John Benediktsson Date: Sat, 20 Mar 2021 15:59:00 +0000 (-0700) Subject: core/basis/extras: use zip-with in a few places. X-Git-Tag: 0.99~2402 X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=commitdiff_plain;h=ffa195f55426bfa92e1fde59ff3d385fd224a5c7 core/basis/extras: use zip-with in a few places. --- diff --git a/basis/help/help.factor b/basis/help/help.factor index 29b3ffc944..f33f0f52b1 100644 --- a/basis/help/help.factor +++ b/basis/help/help.factor @@ -78,7 +78,7 @@ M: alias word-help* } 1|| ; : sort-articles ( seq -- newseq ) - [ dup article-title ] { } map>assoc sort-values keys ; + [ article-title ] zip-with sort-values keys ; : all-errors ( -- seq ) all-words [ error? ] filter sort-articles ; diff --git a/basis/ui/tools/browser/popups/popups.factor b/basis/ui/tools/browser/popups/popups.factor index 8108448b73..f770d865e8 100644 --- a/basis/ui/tools/browser/popups/popups.factor +++ b/basis/ui/tools/browser/popups/popups.factor @@ -20,8 +20,7 @@ TUPLE: links-popup < wrapper ; : ( model quot -- table ) '[ - @ sort-articles - [ dup article-title ] { } map>assoc + @ sort-articles [ article-title ] zip-with ] link-renderer [ second ] dup table>> [ invoke-primary-operation ] >>action [ hide-glass ] >>hook diff --git a/core/compiler/units/units.factor b/core/compiler/units/units.factor index b0662f8fa9..9792bd5256 100644 --- a/core/compiler/units/units.factor +++ b/core/compiler/units/units.factor @@ -78,7 +78,7 @@ M: f to-recompile changed-definitions get filter-word-defs ; M: f recompile - [ dup def>> ] { } map>assoc ; + [ def>> ] zip-with ; M: f process-forgotten-words drop ; diff --git a/extra/ctags/ctags.factor b/extra/ctags/ctags.factor index cc83aa13d8..bb1d2b76b2 100644 --- a/extra/ctags/ctags.factor +++ b/extra/ctags/ctags.factor @@ -11,7 +11,7 @@ IN: ctags assoc sift-values ; + [ where ] zip-with sift-values ; : ctag ( word path lineno -- str ) [ diff --git a/extra/lint/lint.factor b/extra/lint/lint.factor index a94fe1c08a..6a4af697fc 100644 --- a/extra/lint/lint.factor +++ b/extra/lint/lint.factor @@ -283,7 +283,7 @@ GENERIC: run-lint ( obj -- obj ) ] assoc-filter ; M: sequence run-lint ( seq -- seq ) - [ dup lint ] { } map>assoc trim-self + [ lint ] zip-with trim-self [ second empty? ] reject filter-symbols ; M: word run-lint ( word -- seq ) 1array run-lint ; diff --git a/extra/reports/noise/noise.factor b/extra/reports/noise/noise.factor index 3f4090c118..c6a735564f 100644 --- a/extra/reports/noise/noise.factor +++ b/extra/reports/noise/noise.factor @@ -120,7 +120,7 @@ M: lambda-word word-noise-factor : noisy-words ( -- alist ) all-words flatten-generics - [ dup word-noise-factor ] { } map>assoc + [ word-noise-factor ] zip-with sort-values reverse ; : noise. ( alist -- ) @@ -140,7 +140,7 @@ M: lambda-word word-noise-factor ] if-empty ; : noisy-vocabs ( -- alist ) - loaded-vocab-names [ dup vocab-noise-factor ] { } map>assoc + loaded-vocab-names [ vocab-noise-factor ] zip-with sort-values reverse ; : noise-report ( -- )