Anonymous user
Topswops: Difference between revisions
m
→{{header|Haskell}}
Line 444:
import Control.Monad
derangements
topswop = ((uncurry (++). first reverse).). splitAt
topswopIter = takeWhile((/=1).head). iterate (topswop =<< head)
Line 451 ⟶ 450:
topSwops :: [Int] -> [(Int, Int)]
topSwops = zip [1..]. map (maximum.
'''Output'''
<pre>*Main> mapM_ print $ take 10 $ topSwops [1..]
|