Update code that did ">alist sort-" to just "sort-".
parent
9efa64831f
commit
d58bc08aa0
|
@ -36,7 +36,7 @@ IN: heaps.tests
|
||||||
] H{ } map>assoc ;
|
] H{ } map>assoc ;
|
||||||
|
|
||||||
: test-heap-sort ( n -- ? )
|
: test-heap-sort ( n -- ? )
|
||||||
random-alist dup >alist sort-keys swap heap-sort = ;
|
random-alist dup sort-keys swap heap-sort = ;
|
||||||
|
|
||||||
14 [
|
14 [
|
||||||
[ t ] swap [ 2^ test-heap-sort ] curry unit-test
|
[ t ] swap [ 2^ test-heap-sort ] curry unit-test
|
||||||
|
|
|
@ -452,7 +452,7 @@ M: array elements*
|
||||||
|
|
||||||
: $definition-icons ( element -- )
|
: $definition-icons ( element -- )
|
||||||
drop
|
drop
|
||||||
icons get >alist sort-keys
|
icons get sort-keys
|
||||||
[ [ <$link> ] [ definition-icon-path <$image> ] bi* swap ] assoc-map
|
[ [ <$link> ] [ definition-icon-path <$image> ] bi* swap ] assoc-map
|
||||||
{ "" "Definition class" } prefix
|
{ "" "Definition class" } prefix
|
||||||
$table ;
|
$table ;
|
||||||
|
|
|
@ -37,7 +37,7 @@ CONSTANT: max-redirects 10
|
||||||
[ "Header injection attack" throw ] when ;
|
[ "Header injection attack" throw ] when ;
|
||||||
|
|
||||||
: write-header ( assoc -- )
|
: write-header ( assoc -- )
|
||||||
>alist sort-keys [
|
sort-keys [
|
||||||
[ check-header-string write ": " write ]
|
[ check-header-string write ": " write ]
|
||||||
[ header-value>string check-header-string write crlf ] bi*
|
[ header-value>string check-header-string write crlf ] bi*
|
||||||
] assoc-each crlf ;
|
] assoc-each crlf ;
|
||||||
|
|
|
@ -21,7 +21,7 @@ SYMBOL: message-histogram
|
||||||
drop ;
|
drop ;
|
||||||
|
|
||||||
: recent-histogram ( assoc n -- alist )
|
: recent-histogram ( assoc n -- alist )
|
||||||
[ >alist sort-values <reversed> ] dip short head ;
|
[ sort-values <reversed> ] dip short head ;
|
||||||
|
|
||||||
: analyze-entries ( entries word-names -- errors word-histogram message-histogram )
|
: analyze-entries ( entries word-names -- errors word-histogram message-histogram )
|
||||||
[
|
[
|
||||||
|
|
|
@ -59,7 +59,7 @@ PRIVATE>
|
||||||
swapd each-permutation ; inline
|
swapd each-permutation ; inline
|
||||||
|
|
||||||
: inverse-permutation ( seq -- permutation )
|
: inverse-permutation ( seq -- permutation )
|
||||||
<enum> >alist sort-values keys ;
|
<enum> sort-values keys ;
|
||||||
|
|
||||||
|
|
||||||
! Combinadic-based combination methodology
|
! Combinadic-based combination methodology
|
||||||
|
|
|
@ -80,7 +80,7 @@ PRIVATE>
|
||||||
[ inc-at ] sequence>hashtable ;
|
[ inc-at ] sequence>hashtable ;
|
||||||
|
|
||||||
: sorted-histogram ( seq -- alist )
|
: sorted-histogram ( seq -- alist )
|
||||||
histogram >alist sort-values ;
|
histogram sort-values ;
|
||||||
|
|
||||||
: collect-values ( seq quot: ( obj hashtable -- ) -- hash )
|
: collect-values ( seq quot: ( obj hashtable -- ) -- hash )
|
||||||
'[ [ dup @ ] dip push-at ] sequence>hashtable ; inline
|
'[ [ dup @ ] dip push-at ] sequence>hashtable ; inline
|
||||||
|
|
|
@ -47,7 +47,7 @@ IN: regexp.minimize
|
||||||
over '[ drop first2 _ _ stay-same? ] assoc-filter ;
|
over '[ drop first2 _ _ stay-same? ] assoc-filter ;
|
||||||
|
|
||||||
: partition>classes ( partitions -- synonyms ) ! old-state => new-state
|
: partition>classes ( partitions -- synonyms ) ! old-state => new-state
|
||||||
>alist sort-keys
|
sort-keys
|
||||||
[ drop first2 swap ] assoc-map
|
[ drop first2 swap ] assoc-map
|
||||||
<reversed>
|
<reversed>
|
||||||
>hashtable ;
|
>hashtable ;
|
||||||
|
|
|
@ -28,7 +28,7 @@ IN: tools.threads
|
||||||
[ [ write ] with-cell ] each
|
[ [ write ] with-cell ] each
|
||||||
] with-row
|
] with-row
|
||||||
|
|
||||||
threads >alist sort-keys values [
|
threads sort-keys values [
|
||||||
[ thread. ] with-row
|
[ thread. ] with-row
|
||||||
] each
|
] each
|
||||||
] tabular-output nl ;
|
] tabular-output nl ;
|
||||||
|
|
|
@ -59,7 +59,7 @@ M: source-file-renderer column-alignment drop { 0 0 1 } ;
|
||||||
M: source-file-renderer filled-column drop 1 ;
|
M: source-file-renderer filled-column drop 1 ;
|
||||||
|
|
||||||
: <source-file-model> ( model -- model' )
|
: <source-file-model> ( model -- model' )
|
||||||
[ group-by-source-file >alist sort-keys ] <arrow> ;
|
[ group-by-source-file sort-keys ] <arrow> ;
|
||||||
|
|
||||||
:: <source-file-table> ( error-list -- table )
|
:: <source-file-table> ( error-list -- table )
|
||||||
error-list model>> <source-file-model>
|
error-list model>> <source-file-model>
|
||||||
|
|
|
@ -141,7 +141,7 @@ PRIVATE>
|
||||||
2dup bounds-check? [ set-nth ] [ 3drop ] if ;
|
2dup bounds-check? [ set-nth ] [ 3drop ] if ;
|
||||||
|
|
||||||
:: fill-ranges ( table -- table )
|
:: fill-ranges ( table -- table )
|
||||||
name-map >alist sort-values keys
|
name-map sort-values keys
|
||||||
[ { [ "first>" tail? ] [ "last>" tail? ] } 1|| ] filter
|
[ { [ "first>" tail? ] [ "last>" tail? ] } 1|| ] filter
|
||||||
2 group [
|
2 group [
|
||||||
[ name>char ] bi@ [ [a,b] ] [ table ?nth ] bi
|
[ name>char ] bi@ [ [a,b] ] [ table ?nth ] bi
|
||||||
|
|
|
@ -67,7 +67,7 @@ M: interpolated [undo-xml]
|
||||||
|
|
||||||
: >enum ( assoc -- enum )
|
: >enum ( assoc -- enum )
|
||||||
! Assumes keys are 0..n
|
! Assumes keys are 0..n
|
||||||
>alist sort-keys values <enum> ;
|
sort-keys values <enum> ;
|
||||||
|
|
||||||
: undo-xml ( xml -- quot )
|
: undo-xml ( xml -- quot )
|
||||||
[undo-xml] '[ H{ } clone [ _ bind ] keep >enum ] ;
|
[undo-xml] '[ H{ } clone [ _ bind ] keep >enum ] ;
|
||||||
|
|
|
@ -24,7 +24,7 @@ ARTICLE: "enums" "Enumerations"
|
||||||
<enum>
|
<enum>
|
||||||
}
|
}
|
||||||
"Inverting a permutation using enumerations:"
|
"Inverting a permutation using enumerations:"
|
||||||
{ $example "IN: scratchpad" ": invert ( perm -- perm' )" " <enum> >alist sort-values keys ;" "{ 2 0 4 1 3 } invert ." "{ 1 3 0 4 2 }" } ;
|
{ $example "IN: scratchpad" ": invert ( perm -- perm' )" " <enum> sort-values keys ;" "{ 2 0 4 1 3 } invert ." "{ 1 3 0 4 2 }" } ;
|
||||||
|
|
||||||
HELP: enum
|
HELP: enum
|
||||||
{ $class-description "An associative structure which wraps a sequence and maps integers to the corresponding elements of the sequence."
|
{ $class-description "An associative structure which wraps a sequence and maps integers to the corresponding elements of the sequence."
|
||||||
|
|
|
@ -19,7 +19,7 @@ CONSTANT: knucleotide-in "vocab:benchmark/knucleotide/knucleotide-input.txt"
|
||||||
|
|
||||||
: handle-table ( inputs n -- )
|
: handle-table ( inputs n -- )
|
||||||
<clumps>
|
<clumps>
|
||||||
[ histogram >alist sort-values reverse ] [ length ] bi
|
[ histogram sort-values reverse ] [ length ] bi
|
||||||
'[
|
'[
|
||||||
[ first write bl ]
|
[ first write bl ]
|
||||||
[ second 100 * _ /f "%.3f" printf nl ] bi
|
[ second 100 * _ /f "%.3f" printf nl ] bi
|
||||||
|
|
|
@ -53,7 +53,7 @@ nonce ;
|
||||||
] H{ } make-assoc ; inline
|
] H{ } make-assoc ; inline
|
||||||
|
|
||||||
:: sign-params ( url request-method consumer-token request-token params -- signed-params )
|
:: sign-params ( url request-method consumer-token request-token params -- signed-params )
|
||||||
params >alist sort-keys :> params
|
params sort-keys :> params
|
||||||
url request-method params signature-base-string :> sbs
|
url request-method params signature-base-string :> sbs
|
||||||
consumer-token secret>> request-token dup [ secret>> ] when hmac-key :> key
|
consumer-token secret>> request-token dup [ secret>> ] when hmac-key :> key
|
||||||
sbs key sha1 hmac-bytes >base64 >string :> signature
|
sbs key sha1 hmac-bytes >base64 >string :> signature
|
||||||
|
|
Loading…
Reference in New Issue