Skip to content

Instantly share code, notes, and snippets.

@WorldDownTown
Created February 26, 2015 05:23
Show Gist options
  • Save WorldDownTown/60f81bdb8e8f646bded9 to your computer and use it in GitHub Desktop.
Save WorldDownTown/60f81bdb8e8f646bded9 to your computer and use it in GitHub Desktop.
-- 1. リストを引数に取って、length に π (=3.1415)を返す関数
pieTime x = fromIntegral (length x) + (pi :: Float)
-- 2. 2つの文字列を引数にとって、数値として足し算する関数
addString x y = (read x::Int) + (read y::Int)
-- 3. 文字列を逆する関数
reverse' x = [x !! z | z <- [((length x) - 1), ((length x) - 2)..0]]
-- 4. 文字列が回文かどうかを判定する関数 isPalindrome
isPalindrome x = reverse' x == x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment