小编mrg*_*023的帖子

Ravi Sethi在Haskell的小被子语言

我正在尝试在Haskell中实现Ravi Sethi的Little Quilt语言.可以在这里看到Sethi的小被子的概述:http://poj.org/problem?id = 3201

这是我到目前为止的功能:

import Data.List.Split

rotate :: Int -> [a] -> [a]
rotate n xs = iterate rot xs !! n 
    where 
        rot xs = last xs : init xs 

turn :: [a] -> [a]
turn x = rotate 2 x

grid :: Int -> [String] -> String
grid n = unlines . map concat . chunksOf n

printAtom :: [String] -> IO() 
printAtom x = putStrLn $ grid 2 x  
Run Code Online (Sandbox Code Playgroud)

我实现rotate了在我的 …

haskell list-manipulation

6
推荐指数
1
解决办法
466
查看次数

标签 统计

haskell ×1

list-manipulation ×1