Skip to content

Instantly share code, notes, and snippets.

@esehara
Created October 1, 2011 14:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save esehara/1256116 to your computer and use it in GitHub Desktop.
Save esehara/1256116 to your computer and use it in GitHub Desktop.
--http://ameblo.jp/programming/entry-10001721422.html
cardlist::String -> Int -> [String]
cardlist cardset member = lines(getcard cardset member 0)
getcard::String -> Int -> Int -> [Char]
getcard cardset member start = if start == member
then ""
else returncard cardset (start + 1) member ++ "\n" ++ getcard cardset member (start + 1)
returncard::String -> Int -> Int -> [Char]
returncard cardset start baisu = if length(cardset) < baisu
then ""
else take 1 (drop (start - 1) cardset) ++ returncard (drop baisu cardset) start baisu
main :: IO()
main = do
print (cardlist "1231234" 3)
print (cardlist "012345012345012345" 6)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment