Skip to content

Commit da1d718

Browse files
committed
haskell 1
1 parent 56d40ca commit da1d718

File tree

2 files changed

+89
-0
lines changed

2 files changed

+89
-0
lines changed

.gitignore

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# <---------------- scheme files ---------------->
2+
*.ss~
3+
*.ss#*
4+
.#*.ss
5+
6+
*.scm~
7+
*.scm#*
8+
.#*.scm
9+
10+
# <---------------- haskell files ---------------->
11+
dist
12+
dist-*
13+
cabal-dev
14+
*.o
15+
*.hi
16+
*.hie
17+
*.chi
18+
*.chs.h
19+
*.dyn_o
20+
*.dyn_hi
21+
.hpc
22+
.hsenv
23+
.cabal-sandbox/
24+
cabal.sandbox.config
25+
*.prof
26+
*.aux
27+
*.hp
28+
*.eventlog
29+
.stack-work/
30+
cabal.project.local
31+
cabal.project.local~
32+
.HTF/
33+
.ghc.environment.*
34+
35+
# <---------------- prolog files ---------------->
36+
37+
# <---------------- smalltalk files ---------------->
38+
# changes file
39+
*.changes
40+
*.chg
41+
42+
# system image
43+
*.image
44+
*.img7
45+
*.img
46+
47+
# Pharo Smalltalk Debug log file
48+
PharoDebug.log
49+
50+
# Squeak Smalltalk Debug log file
51+
SqueakDebug.log
52+
53+
# Dolphin Smalltalk source file
54+
*.sml
55+
56+
# Dolphin Smalltalk error file
57+
*.errors
58+
59+
# Monticello package cache
60+
/package-cache
61+
62+
# playground cache
63+
/play-cache
64+
/play-stash
65+
66+
# Metacello-github cache
67+
/github-cache
68+
github-*.zip
69+
70+
# <---------------- cilk/cilk++ files ---------------->
71+
72+
# <---------------- general files ---------------->
73+
*.exe
74+
*.out

Haskell/01/power.hs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
power :: Integer -> Integer -> Integer
2+
power m n
3+
| n == 0 = 1
4+
| n > 0 = m * power m (n - 1)
5+
6+
main ::IO()
7+
main = do
8+
putStrLn "Enter a base number:"
9+
in1 <- getLine
10+
putStrLn "Enter an exponent:"
11+
in2 <- getLine
12+
let base = (read in1 :: Integer)
13+
let exponent = (read in2 :: Integer)
14+
putStrLn "Answer:"
15+
print(power base exponent)

0 commit comments

Comments
 (0)