Commits: 3
Merge branch 'rewrite-content-ellie' of gitlab.com:software-garden/software-garden.gitlab.io into rewrite-content-ellie
Change code Terminal to code Elm Repl on day 3 and day 4.
Put Fana's bio before Sam.
Change widget terminal to elmRepl in Mark.Custom.
Change terminal to elmRepl in Mark/Custom so we can use the online Elm Repl.
index 19b53ef..e6dd358 100644
--- a/content/day-3.txt
+++ b/content/day-3.txt
@@ -28,7 +28,7 @@ For efficiency we are going to play with these concepts in REPL (the Read - Eval
=
=It should show something like this
=
-| Terminal
+| ElmRepl
= ---- Elm 0.19.0 ----------------------------------------------------------------
= Read <https://elm-lang.org/0.19.0/repl> to learn more: exit, help, imports, etc.
= --------------------------------------------------------------------------------
@@ -41,7 +41,7 @@ Here you can enter snippets of Elm code and see it evaluated.
=
=Let's start with values. The simplest way to create a value is to literally type it in our code. Try it (type things after {Code|>} and expect to see what follows):
=
-| Terminal
+| ElmRepl
= > 2
= 2 : number
= > "Hello"
@@ -52,7 +52,7 @@ These expressions ({Code|2} and {Code|"Hello!"}) are called /literals/, because
=
=Some value literals are simple, like numbers and strings. Some are complex. Previously we have touched the subject of lists. You can also type them literally, like this:
=
-| Terminal
+| ElmRepl
= > [ 1, 2, 5, 77, 2 ]
= [1,2,5,77.6,2] : List number
=
@@ -63,13 +63,13 @@ First notice that a list literal starts with {Code|[} and ends with {Code|]}. In
=
=List can be empty:
=
-| Terminal
+| ElmRepl
= > []
= [] : List a
=
=or contain only one element:
=
-| Terminal
+| ElmRepl
= > [ "Hello" ]
= ["Hello"] : List String
=
@@ -78,7 +78,7 @@ or contain only one element:
=
=Now let's focus our attention to *names*. If you have a value, you can give it a name.
=
-| Terminal
+| ElmRepl
= > kittens = 2
= 2 : number
= > greeting = "Hello!"
@@ -87,7 +87,7 @@ Now let's focus our attention to *names*. If you have a value, you can give it a
=
=From now on you can refer to this value either literally or by its name:
=
-| Terminal
+| ElmRepl
= > kittens
= 2 : number
= > 2
@@ -95,19 +95,19 @@ From now on you can refer to this value either literally or by its name:
=
=The effect will be exactly the same - you will get a value back. So we see that there are at least two ways of getting values: by literally expressing them or referring to them by names given to them previously. In a composite value of a list, you can mix the two ways together:
=
-| Terminal
+| ElmRepl
= > [ 1, kittens, 3 ]
= [1,2,3] : List number
=
=A *function* is a special kind of a value. Let's create a named function like this:
=
-| Terminal
+| ElmRepl
= > fun something = something ++ " is fun!"
= <function> : String -> String
=
=Here we gave a name {Code|fun} to a function, that given {Code|something} will produce a string saying that this {Code|something} is fun! Let's see how you can use it:
=
-| Terminal
+| ElmRepl
= > fun "Learning Elm"
= "Learning Elm is fun!" : String
=
@@ -129,13 +129,13 @@ Not every function can be applied to any value. You can add two numbers (like {C
=
=Every value in Elm has a type. You can see the type in the REPL - after evaluating the expression it shows its value and the type, like here:
=
-| Terminal
+| ElmRepl
= > kittens
= 2 : number
=
=Above {Code|2} is the value and `number` is the type. Similar here:
=
-| Terminal
+| ElmRepl
= > fun "Learning Elm"
= "Learning Elm is fun!" : String
=
@@ -143,19 +143,19 @@ The value is {Code|"Learning Elm is fun!"} and the type is {Code|String}.
=
=Composite values like lists have composite types. For example here the type is {Code|List String}.
=
-| Terminal
+| ElmRepl
= > [ "Hello", "Good bye" ]
= ["Hello","Good bye"] : List String
=
=This means that it's a list of strings. All the elements of this list are of type {Code|String}. When talking about lists you have to tell that it's a list and what is the type of its elements. Only this can be considered a fully specified type. Compare:
=
-| Terminal
+| ElmRepl
= > [ 1, 2, 3 ]
= [1,2,3] : List number
=
=This is a list of numbers. It's easy to see - all the elements are numbers, just as previously they were strings. All the elements of a list must be of the same type. If you try mixing the types, Elm will refuse to build your program. Try:
=
-| Terminal
+| ElmRepl
= > [ 1, 2, 3, "Carrot" ]
= -- TYPE MISMATCH ----------------------------------------------------------- elm
=
@@ -179,7 +179,7 @@ This is a list of numbers. It's easy to see - all the elements are numbers, just
=
=What's the type of an empty list? Let's see:
=
-| Terminal
+| ElmRepl
= > []
= [] : List a
=
@@ -190,13 +190,13 @@ A list of {Code|a}. Obviously {Code|a} is not a type. This means that the type o
=
=Above I said that every value has a type and also that a function is a value on its own. Let's try the following in REPL:
=
-| Terminal
+| ElmRepl
= > fun
= <function> : String -> String
=
=We have asked the REPL to tell as the value referenced by name {Code|fun}. In response the REPL display the value as {Code|<function>}. That's because there is no simple way to represent the value of a function as text. Let's focus our attention on the type (part after the colon {Code|:}). It is {Code|String -> String}. This means that the type is a function (we recognize it by the arrow symbol). What's before the arrow is a type of the value that goes into the function (called the /argument of the function/). The type of the argument is {Code|String}. That shouldn't be a surprise. Remember how we have used the function before to produce the value:
=
-| Terminal
+| ElmRepl
= > fun "Learning Elm"
= "Learning Elm is fun!" : String
=
@@ -206,19 +206,19 @@ The part after the arrow symbol is the type that the function returns. It is als
=
=Not every function returns the same type as it takes. For example the function {Code|String.fromInt} takes a value of type {Code|Int} and returns a value of type {Code|String}. Its type is therefore {Code|Int -> String}. We read it as: /type of String.fromInt is a function from Int to String/. Let's see it in action:
=
-| Terminal
+| ElmRepl
= > String.fromInt 10
= "10" : String
=
=That's right! The value {Code|10} is an {Code|Int}, the value {Code|"10"} is a {Code|String}.
=
-| Terminal
+| ElmRepl
= > String.fromInt
= <function> : Int -> String
=
=But what if we want to say that a certain number (say, {Code|232}) is fun? We have our {Code|fun} function, but it takes a {Code|String} and what we have is an {Code|Int}. We can use the very same {Code|String.fromInt} to first convert it into the {Code|String} and then pass the value to the {Code|fun} function, like this:
=
-| Terminal
+| ElmRepl
= > fun (String.fromInt 232)
= "232 is fun!" : String
=
@@ -226,7 +226,7 @@ We had to put the {Code|String.fromInt 232} expression in parentheses, so that E
=
=Alternatively we can use the pipe operator which looks like this: {Code|\|>}. It has the advantage that the transformations that happen first are on the left side and ones that happen later on the right. We can read our code left to right instead of inside out. Here is how it would look like:
=
-| Terminal
+| ElmRepl
= > 232 |> String.fromInt |> fun
= "232 is fun!" : String
=
@@ -239,12 +239,12 @@ But what are functions good for? They are very good for making similar values th
=
=We don't have to create all the functions that we need. There are thousands of them already defined and we can use them by importing modules. We already did that. First you import a module like this:
=
-| Terminal
+| ElmRepl
= > import String
=
=And then use any name that it exposes, like this
=
-| Terminal
+| ElmRepl
= > String.fromInt 10
= "10" : String
=
@@ -845,7 +845,7 @@ and another is:
=
=Elm won't have that. Fortunately there is an easy way to satisfy the type system. The {Code|String.fromFloat} takes a {Code|Float} and gives a {Code|String}. Try it in the REPL:
=
-| Terminal
+| ElmRepl
= > String.fromFloat
= <function> : Float -> String
=index 5cf6d1a..497fe17 100644
--- a/content/day-4.txt
+++ b/content/day-4.txt
@@ -2823,7 +2823,7 @@ Nice, but what's going on here:
= )
= ]
= []
-
+
=
=There are three new things here:
=
@@ -2840,7 +2840,7 @@ But what if the entry for a given key is not there? For example we have not inse
=
=If there is an entry, we will get a list of records. We want a list of segments. Each of the records can be passed to the {Code|segment} function to produce one segment. That's where {Code|List.map} comes in. Given a list and a function it will call the function with each of the elements in the list and give back the list of produced values. Let's see a simpler example in the REPL:
=
-| Terminal
+| ElmRepl
= > fun something = something ++ " is fun!"
= <function> : String -> String
= > fun "Learning Elm"index 79e54bd..527240c 100644
--- a/content/index.txt
+++ b/content/index.txt
@@ -48,6 +48,6 @@ You can learn more about {Link|our motivation|url=/motivation.html}. Below is ma
=
=I love the creativity of the software development and hope to share that passion with you.
=
-*Sam* is a co-author of the workshop. He is an Elm developer at {Link|itravel|url=https://www.itravel.de/} in Cologne, Germany.
-
=*Fana* is a junior software developer (an ex marine biologist {Icon|name=anchor}) and coordinator of our project. She keeps us on the right track. Also she is taking care of our media presence.
+
+*Sam* is a co-author of the workshop. He is an Elm developer at {Link|itravel|url=https://www.itravel.de/} in Cologne, Germany.index 499cdc9..e4c7f4c 100644
--- a/src/Main.elm
+++ b/src/Main.elm
@@ -799,7 +799,7 @@ document =
=
= widgets =
= [ Mark.Custom.editor
- , Mark.Custom.terminal
+ , Mark.Custom.elmRepl
= , Mark.Custom.note
= ]
=index 745e5af..88c3af4 100644
--- a/src/Mark/Custom.elm
+++ b/src/Mark/Custom.elm
@@ -1,6 +1,7 @@
=module Mark.Custom exposing
= ( colors
= , editor
+ , elmRepl
= , emphasize
= , header
= , icon
@@ -11,7 +12,6 @@ module Mark.Custom exposing
= , note
= , paragraph
= , row
- , terminal
= , text
= , title
= , window
@@ -215,8 +215,8 @@ editor =
= )
=
=
-terminal : Mark.Block (a -> Element msg)
-terminal =
+elmRepl : Mark.Block (a -> Element msg)
+elmRepl =
= let
= render content model =
= Element.column
@@ -250,7 +250,7 @@ terminal =
= , Font.monospace
= ]
= ]
- (Element.text "terminal")
+ (Element.text "Elm Repl")
= ]
= , content
= |> String.split "\n"
@@ -276,7 +276,7 @@ terminal =
= ]
= ]
= in
- Mark.block "Terminal"
+ Mark.block "ElmRepl"
= render
= Mark.multiline
=Remove import String from Elm Repl on day 3.
index e6dd358..7389e27 100644
--- a/content/day-3.txt
+++ b/content/day-3.txt
@@ -237,18 +237,7 @@ But what are functions good for? They are very good for making similar values th
=| Note
= Just like machines for painting eggs are useful if you have a lot of eggs to paint. If you only need one or two painted eggs, then it's probably better to just get them painted. But if you have thousands, maybe it's worth to build a machine for it.
=
-We don't have to create all the functions that we need. There are thousands of them already defined and we can use them by importing modules. We already did that. First you import a module like this:
-
-| ElmRepl
- > import String
-
-And then use any name that it exposes, like this
-
-| ElmRepl
- > String.fromInt 10
- "10" : String
-
-If the name comes from an imported module, you need to prefix it with the name of the module, like we did above.
+We don't have to create all the functions that we need. There are thousands of them already defined and we can use them by importing modules.
=
=Let's look at our code and try to recognize some literal values, lists, names and functions. Here is how it should look after day 2:
=