From 59d801c0dfda9a7ddf27261d8a6f7906b049de0a Mon Sep 17 00:00:00 2001 From: DR6 Date: Sat, 29 Jun 2013 23:10:47 +0100 Subject: [PATCH 1/3] Added IO to haskell's tutorial --- haskell.html.markdown | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/haskell.html.markdown b/haskell.html.markdown index 563674c9..fbaa93f2 100644 --- a/haskell.html.markdown +++ b/haskell.html.markdown @@ -259,7 +259,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`. From 0a65fd6171b7543b1f31e147d207b33504344a26 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 29 Jun 2013 15:37:42 -0700 Subject: [PATCH 2/3] Updated clojure --- clojure.html.markdown | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/clojure.html.markdown b/clojure.html.markdown index 24250a87..c5298aab 100644 --- a/clojure.html.markdown +++ b/clojure.html.markdown @@ -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 From e8f407728da807cc22648f341c7fa337b973fb6f Mon Sep 17 00:00:00 2001 From: Malcolm Fell Date: Sun, 30 Jun 2013 13:13:25 +1200 Subject: [PATCH 3/3] Remove python as requested language from README --- README.markdown | 1 - 1 file changed, 1 deletion(-) diff --git a/README.markdown b/README.markdown index 3223a2bd..77e09abd 100644 --- a/README.markdown +++ b/README.markdown @@ -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.