Decorate-sort-undecorate idiom: Difference between revisions
m
→{{header|Haskell}}: Added version with hidden decoration and undecoration
m (→{{header|Haskell}}: Added version with hidden decoration and undecoration) |
|||
Line 253:
("chrestomathy",12)</pre>
and equivalently:
<syntaxhighlight lang="haskell">import Data.List (sortOn)
main :: IO ()
main =
mapM_ print $
sortOn
length
[ "Rosetta",
"code",
"is",
"a",
"programming",
"chrestomathy",
"site"
]</syntaxhighlight>
{{Out}}
<pre>"a"
"is"
"code"
"site"
"Rosetta"
"programming"
"chrestomathy"</pre>
=={{header|JavaScript}}==
|