小编Bis*_*mal的帖子

Rotating a list in Haskell with all posibilities

How can I edit the following code to make Haskell show all the possibilities of rotating an input list from the user :

rotate ::  Int -> [a] -> [a]
rotate n text = take (length text) (drop n (cycle text)) 
Run Code Online (Sandbox Code Playgroud)

I assume that to print all the possibilities we need to drop the first element X times. where X is the length of the list entered.

circle ::  [a] -> [[a]]
circle text = take (length text) (drop (1) …
Run Code Online (Sandbox Code Playgroud)

haskell functional-programming list

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

标签 统计

functional-programming ×1

haskell ×1

list ×1