2
0
Fork 0
mirror of https://github.com/MartinThoma/LaTeX-examples.git synced 2025-04-25 22:38:04 +02:00

Haskell angefangen

This commit is contained in:
Martin Thoma 2014-02-01 15:32:13 +01:00
parent ff14701ccf
commit 3b44772968
14 changed files with 147 additions and 6 deletions

View file

@ -0,0 +1,4 @@
binom n k =
if (k==0) || (k==n)
then 1
else binom (n-1) (k-1) + binom (n-1) k

View file

@ -0,0 +1,9 @@
$ ghci binomialkoeffizient.hs
GHCi, version 7.4.2: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
[1 of 1] Compiling Main ( binomialkoeffizient.hs, interpreted )
Ok, modules loaded: Main.
*Main> binom 5 2
10

View file

@ -0,0 +1,2 @@
f x = sin x / x
g x = x * (f (x*x))

View file

@ -0,0 +1,2 @@
fakAcc n acc = if (n==0) then acc else fakAcc (n-1) (n*acc)
fak n = fakAcc n 1

View file

@ -0,0 +1 @@
fak n = if (n==0) then 1 else n * fak (n-1)

View file

@ -0,0 +1 @@
main = putStrLn "Hello, World!"