mirror of
https://github.com/MartinThoma/LaTeX-examples.git
synced 2025-04-26 06:48:04 +02:00
GeoTopo images for easier compiling; Lazy evalution; Logik
This commit is contained in:
parent
1eb807d278
commit
1938222321
11 changed files with 215 additions and 5 deletions
12
documents/Programmierparadigmen/scripts/haskell/folds.hs
Normal file
12
documents/Programmierparadigmen/scripts/haskell/folds.hs
Normal file
|
@ -0,0 +1,12 @@
|
|||
summer :: [Int] -> Int
|
||||
summer = foldr (-) 0
|
||||
|
||||
summel :: [Int] -> Int
|
||||
summel = foldl (-) 0
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
print (summer [1,2,3])
|
||||
-- 0-(1-(2-3)) = 0-(1-(-1)) = 2
|
||||
print (summel [1,2,3])
|
||||
-- ((0-1)-2)-3 = -6
|
Loading…
Add table
Add a link
Reference in a new issue