Skip to content

Instantly share code, notes, and snippets.

@Leonidas-from-XIV
Created March 27, 2014 11:51
Show Gist options
  • Select an option

  • Save Leonidas-from-XIV/9805860 to your computer and use it in GitHub Desktop.

Select an option

Save Leonidas-from-XIV/9805860 to your computer and use it in GitHub Desktop.
module Main where
input = [
"4", "S", "a", "t", "z", "0",
"3", "D", "a", "s", "17",
"3", "e", "i", "n", "1",
"3", "i", "s", "t", "12"
]
traverse :: [String] -> Int -> [String]
traverse [] _ = []
traverse _ 0 = []
traverse input n = word:(traverse input jmp)
where len = (read (input !! (n-1))::Int)
start = drop n input
word = concat $ take len start
(jump:_) = drop len start
jmp = read jump::Int
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment