Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Hanoi solver
--ghc 8.0.1 /opt/ghc/8.0.1/lib/ghc-8.0.0.20160127/ main = do print $ hanoi 5 "a" "b" "c" type Peg = String type Move = (Peg, Peg) hanoi :: Integer -> Peg -> Peg -> Peg -> [Move] hanoi 0 _ _ _ = [] hanoi 1 a b c = [(a,c)] hanoi n a c b = hanoi (n-1) a b c ++ [(a,b)] ++ hanoi (n-1) c a b
run
|
edit
|
history
|
help
0
Derive type class for parameterized data type
haskell_exam
State
Goodstein sequences
Factorial in haskell
Producter
divisibleBy a b
equiv_strings
Perfect numbers
Pascal's triangle in 10 lines