1
0
Fork 0
Using the GHC REPL and Haskell to teach programming concepts through the guise of mathematics. Powered by Nix.
 
 
 
 
 
Go to file
Bill Ewanick 42afd893c9 Implement solution in Haskell as depth-first-search 2023-11-17 14:44:39 -05:00
.vscode Ignore hint 2023-11-10 10:41:44 -05:00
src Implement solution in Haskell as depth-first-search 2023-11-17 14:44:39 -05:00
.envrc Flakify initial commit for Haskell REPL 2023-09-12 01:23:35 -04:00
.ghci Minor tweaks 2023-09-13 11:37:19 -04:00
.gitignore Hide all files, add to clean script 2023-09-19 15:42:44 -04:00
README.md Minor tweaks 2023-09-13 11:37:19 -04:00
flake.lock Flakify initial commit for Haskell REPL 2023-09-12 01:23:35 -04:00
flake.nix Run gofmt on code 2023-11-15 17:37:09 -05:00

README.md

The Universal Calculator

Using the GHC REPL and Haskell to teach programming concepts through the guise of mathematics.
A handy assistant to help you understand and solve maths problems.

How to use

λ> 5 * 5
25

λ> 1 + 5
6

λ> 10 / 2
5.0

λ> 10 `div` 2
5

λ> 10 `div` 3
3

λ> 10 / 3
3.3333333333333335

λ> :t sum
sum :: (Foldable t, Num a) => t a -> a

λ> :t sum [1..100]
sum [1..100] :: (Num a, Enum a) => a

λ> sum [1..100]
5050

λ> f x = 5*x^3 + 4*x + 2

λ> f 1
11

λ> f 10
5042

λ> f 100
5000402

λ> map f [1..10]
[11,50,149,338,647,1106,1745,2594,3683,5042]

λ> putStrLn "Hello, world!"
Hello, world!

How to install

  • Use the DeterminateSystems installer to install Nix with Flakes.
  • cd into the top level of this repo.
  • nix develop and let Nix load the flake and set everything up.
  • ghci and get computing!
    • To enable performance timings after every input, type λ> :set +s in the REPL
    • See other initial commands being run in the .ghci file.