Largest int from concatenated ints: Difference between revisions

added Factor
(Realize in F#)
(added Factor)
Line 553:
fN [54; 546; 548; 60] -> "6054854654"
</pre>
 
=={{header|Factor}}==
Using algorithm 3:
<lang factor>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@</lang>
{{out}}
<pre>
998764543431
6054854654
</pre>
 
=={{header|Fortran}}==
There is often a potential ambiguity when reading numbers. While three definitely names the Platonic number notion, 3 might instead be regarded as being a text that happens to have the glyph of a number but is not a number. This sort of discussion arises when a spreadsheet has read in a text file and behold! numbers are on the display and they look just like what is displayed when numbers are being shown, but, they are ''not'' numbers, they are only drawn that way. Within the spreadsheet they are parts of some text, and the notion that takes over is one of a "blunt, heavy object", not alas close to hand.
1,827

edits