Production Level Knowledge & Tips

  1. 未分類
  2. 56 view

[Haskell]Least Fixed-Point

import Data.Function

factF f = \n -> if n == 0 then 1 else n * f(n-1)
fact0 = factF undefined
fact1 = factF . factF $ undefined
fact2 = factF . factF . factF $ undefined
fact3 = factF . factF . factF . factF $ undefined
fact = fix factF
$ghci
Prelude>:load fact.hs
*Main> fact0 0
1
*Main> fact0 1
*** Exception: Prelude.undefined
*Main> fact1 0
1
*Main> fact1 1
1
*Main> fact1 2
*** Exception: Prelude.undefined
*Main> fact 100
93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000

未分類 recent post

  1. Install sbt 1.0.0 and run sample template

  2. Visualization of Neural Network and its Train…

  3. [Machine Learning]Created docker image includ…

  4. [Node.js]How to write batch script with Node.…

  5. [Hive]Get top n items for each category

関連記事

PAGE TOP