factorial :: Int -> Int factorial n = product [1..n] factorial maps any integer n to the product of the integers between 1 and n ex) factorial 4 = product [1..4] = product [1,2,3,4] = 1 ...
factorial :: Int -> Int factorial n = product [1..n] factorial maps any integer n to the product of the integers between 1 and n ex) factorial 4 = product [1..4] = product [1,2,3,4] = 1 ...
Conditional Expressions abs :: Int -> Int abs n = if n >= 0 then n else -n signum :: Int -> Int signum n = if n < 0 then -1 else if n == 0 then 0 else 1 ...
Set Comprehensions the comprehension notation can be used to construct new sets from old sets x <- [1..5] : generator Comprehensions can have multiple generators , separated bu commas e ...
Type Error > 1+ False Error Type in Haskell (expression)e :: (type)t :type in GHCi > not False True calculates the type of an expression > :type not False ...
몇 주 전, Coursera에서 시작하는 한 코스를 등록했는데… 너무 빡쎄서 ㅠ.ㅠ 어쩌지 하고 있던 상황에서 괜찮은 코스를 알게되었다. *FP101x Introduction to F ...