Skip to content

Instantly share code, notes, and snippets.

@nomeaning777
Created July 22, 2012 16:19
Show Gist options
  • Save nomeaning777/3160176 to your computer and use it in GitHub Desktop.
Save nomeaning777/3160176 to your computer and use it in GitHub Desktop.
プログラミングHaskell 2.6 練習問題
-- 3 エラー修正
n = a `div` length xs
where
a = 10
xs = [1,2,3,4,5]
-- 4. 空でないリストの最後の要素
mylast1 list = list!!((length list) - 1)
mylast2 list = head (reverse list)
-- 5. 空でないリストから最後の要素を取り除く
myinit1 list = reverse (tail (reverse list))
myinit2 list = take ((length list) - 1) list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment