] H{ } map>assoc ;
: test-heap-sort ( n -- ? )
- random-alist dup >alist sort-keys swap heap-sort = ;
+ random-alist dup sort-keys swap heap-sort = ;
14 [
[ t ] swap [ 2^ test-heap-sort ] curry unit-test
: $definition-icons ( element -- )
drop
- icons get >alist sort-keys
+ icons get sort-keys
[ [ <$link> ] [ definition-icon-path <$image> ] bi* swap ] assoc-map
{ "" "Definition class" } prefix
$table ;
[ "Header injection attack" throw ] when ;
: write-header ( assoc -- )
- >alist sort-keys [
+ sort-keys [
[ check-header-string write ": " write ]
[ header-value>string check-header-string write crlf ] bi*
] assoc-each crlf ;
drop ;\r
\r
: recent-histogram ( assoc n -- alist )\r
- [ >alist sort-values <reversed> ] dip short head ;\r
+ [ sort-values <reversed> ] dip short head ;\r
\r
: analyze-entries ( entries word-names -- errors word-histogram message-histogram )\r
[\r
swapd each-permutation ; inline
: inverse-permutation ( seq -- permutation )
- <enum> >alist sort-values keys ;
+ <enum> sort-values keys ;
! Combinadic-based combination methodology
[ inc-at ] sequence>hashtable ;
: sorted-histogram ( seq -- alist )
- histogram >alist sort-values ;
+ histogram sort-values ;
: collect-values ( seq quot: ( obj hashtable -- ) -- hash )
'[ [ dup @ ] dip push-at ] sequence>hashtable ; inline
over '[ drop first2 _ _ stay-same? ] assoc-filter ;
: partition>classes ( partitions -- synonyms ) ! old-state => new-state
- >alist sort-keys
+ sort-keys
[ drop first2 swap ] assoc-map
<reversed>
>hashtable ;
[ [ write ] with-cell ] each\r
] with-row\r
\r
- threads >alist sort-keys values [\r
+ threads sort-keys values [\r
[ thread. ] with-row\r
] each\r
] tabular-output nl ;\r
M: source-file-renderer filled-column drop 1 ;
: <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 )
error-list model>> <source-file-model>
2dup bounds-check? [ set-nth ] [ 3drop ] if ;
:: fill-ranges ( table -- table )
- name-map >alist sort-values keys
+ name-map sort-values keys
[ { [ "first>" tail? ] [ "last>" tail? ] } 1|| ] filter
2 group [
[ name>char ] bi@ [ [a,b] ] [ table ?nth ] bi
: >enum ( assoc -- enum )
! Assumes keys are 0..n
- >alist sort-keys values <enum> ;
+ sort-keys values <enum> ;
: undo-xml ( xml -- quot )
[undo-xml] '[ H{ } clone [ _ bind ] keep >enum ] ;
<enum>
}
"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
{ $class-description "An associative structure which wraps a sequence and maps integers to the corresponding elements of the sequence."
: handle-table ( inputs n -- )
<clumps>
- [ histogram >alist sort-values reverse ] [ length ] bi
+ [ histogram sort-values reverse ] [ length ] bi
'[
[ first write bl ]
[ second 100 * _ /f "%.3f" printf nl ] bi
] H{ } make-assoc ; inline
:: 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
consumer-token secret>> request-token dup [ secret>> ] when hmac-key :> key
sbs key sha1 hmac-bytes >base64 >string :> signature