June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84614 additions and 14267 deletions
|
|
@ -0,0 +1,15 @@
|
|||
USING: assocs io kernel math qw sequences sorting ;
|
||||
IN: rosetta-code.largest-int
|
||||
|
||||
: pad ( target seq -- padded )
|
||||
2dup length / swap <repetition> concat swap head ;
|
||||
|
||||
: largest-int ( seq -- )
|
||||
dup dup [ length ] map supremum ! find longest length so we know how much to pad
|
||||
[ swap pad ] curry map ! pad the integers
|
||||
<enum> sort-values ! sort the padded integers
|
||||
keys ! find the original indices of the sorted integers
|
||||
swap nths ! order non-padded integers according to their sorted order
|
||||
reverse concat print ;
|
||||
|
||||
qw{ 1 34 3 98 9 76 45 4 } qw{ 54 546 548 60 } [ largest-int ] bi@
|
||||
Loading…
Add table
Add a link
Reference in a new issue