Merge branch 'master' of github.com:adambard/learnxinyminutes-docs

This commit is contained in:
noahlz 2013-06-29 23:23:24 -04:00
commit f276900d9b
3 changed files with 30 additions and 4 deletions

View File

@ -17,7 +17,6 @@ properly!
The most requested languages are:
* Scala
* Python
* Javascript
... but there are many more requests to do "every language", so don't let that stop you.

View File

@ -59,10 +59,12 @@ and often automatically.
(class false) ; Booleans are java.lang.Boolean
(class nil); The "null" value is called nil
; If you want to create a literal list of data, use ' to make a "symbol"
; If you want to create a literal list of data, use ' to stop it from
; being evaluated
'(+ 1 2) ; => (+ 1 2)
; (shorthand for (quote (+ 1 2))
; You can eval symbols.
; You can eval a quoted list
(eval '(+ 1 2)) ; => 3
; Collections & Sequences

View File

@ -263,7 +263,32 @@ Just "hello"
Just 1
----------------------------------------------------
-- 8. The Haskell REPL
-- 8. Haskell IO
----------------------------------------------------
-- While IO can't be explained fully without explaining monads
-- it is not hard to explain enough to get going
-- An IO a value is an IO action: you can chain them with do blocks
action = do
putStrLn "This is a line. Duh"
input <- getLine -- this gets a line and gives it the name "input"
input2 <- getLine
return (input1++"\n"++input2) -- This is the result of the whole action
-- This didn't actually do anything. When a haskell program is executed
-- an IO action called "main" is read and interprete
main = do
putStrLn "Our first program. How exciting!"
result <- action -- our defined action is just like the default ones
putStrLn result
putStrLn "This was all, folks!"
----------------------------------------------------
-- 9. The Haskell REPL
----------------------------------------------------
-- Start the repl by typing `ghci`.