Tech Tips

  1. Uncategorized
  2. 169 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

Uncategorized recent post

  1. Udacity Self-Driving Car Engineer Nanodegree …

  2. Install sbt 1.0.0 and run sample template

  3. Visualization of Neural Network and its Train…

  4. [Machine Learning]Created docker image includ…

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

関連記事

PAGE TOP