Skip to content

Instantly share code, notes, and snippets.

@vito
Created January 29, 2009 19:57
Show Gist options
  • Save vito/54708 to your computer and use it in GitHub Desktop.
Save vito/54708 to your computer and use it in GitHub Desktop.
import Data.List (isPrefixOf)
(%) :: String -> [String] -> String
"" % _ = ""
s % xs | "%s" `isPrefixOf` s = next ++ (drop 2 s) % queue
| otherwise = (head s) : (tail s) % xs
where next = head xs
queue = tail xs
main = print ("Hello, %s! My name is %s!" % ["World", "Alex"])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment