Haskell Name Game

Main> nameGame "alonzo"
"alonzo, alonzo bo blonzo bonana fanna fo flonzo fee fy mo mlonzo, alonzo"
Main> nameGame "haskell"
"haskell, haskell bo baskell bonana fanna fo faskell fee fy mo maskell, haskell"

LOLz. Here’s some real beginner-level source code for a version of the “Name Game”. The Name Game was a song from way back. It’s silly.

Sources after the jump.

nameGame n =
  let sound = firstSound n
      endSound = drop ( length sound ) n
  in
    n ++ ", " ++ n ++ " bo b" ++ endSound ++ " bonana fanna fo f" ++
      endSound ++ " fee fy mo m" ++ endSound ++ ", " ++ n

firstSound n = 
  let n1 = ( head n ) : []
      n2 = head n : head ( tail n ) : []
      n3 = head n : head ( tail n ) : head ( tail ( tail n ) ) : []
  in  
    case n3 of 
      "chr" -> n3
      _ ->
        case n2 of 
          "sh" -> n2
          "bl" -> n2
          "br" -> n2
          "cl" -> n2
          "cr" -> n2
          "dr" -> n2
          "fl" -> n2
          "fr" -> n2
          "gl" -> n2
          "gr" -> n2
          "st" -> n2
          "th" -> n2
          _ -> n1