Skip to main content
Correct pronunciation to 5 syllables for the last line, according to the discussion in the comments
Source Link
Justin
  • 21.4k
  • 9
  • 68
  • 117

Haskell

fact :: Int -> Int          -- fact is Int to Int
fact x = product (range x)  -- fact x is product range x
range x = [1..x]            -- range x is 1 to[pause] x

Haskell education time:

  • The range x function creates a list of integers from 1 up to the value of x.
  • The fact x function multiplies all the values of the list range x together to compute the result.
  • The first line says that the fact function takes an integer and returns an integer.

Haskell

fact :: Int -> Int          -- fact is Int to Int
fact x = product (range x)  -- fact x is product range x
range x = [1..x]            -- range x is 1 to x

Haskell education time:

  • The range x function creates a list of integers from 1 up to the value of x.
  • The fact x function multiplies all the values of the list range x together to compute the result.
  • The first line says that the fact function takes an integer and returns an integer.

Haskell

fact :: Int -> Int          -- fact is Int to Int
fact x = product (range x)  -- fact x is product range x
range x = [1..x]            -- range x is 1 [pause] x

Haskell education time:

  • The range x function creates a list of integers from 1 up to the value of x.
  • The fact x function multiplies all the values of the list range x together to compute the result.
  • The first line says that the fact function takes an integer and returns an integer.
Source Link
danmcardle
  • 755
  • 4
  • 8

Haskell

fact :: Int -> Int          -- fact is Int to Int
fact x = product (range x)  -- fact x is product range x
range x = [1..x]            -- range x is 1 to x

Haskell education time:

  • The range x function creates a list of integers from 1 up to the value of x.
  • The fact x function multiplies all the values of the list range x together to compute the result.
  • The first line says that the fact function takes an integer and returns an integer.