-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f265dbf
commit d2e6c38
Showing
9 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"type": "application", | ||
"source-directories": [ | ||
"src" | ||
], | ||
"elm-version": "0.19.1", | ||
"dependencies": { | ||
"direct": { | ||
"elm/browser": "1.0.2", | ||
"elm/core": "1.0.5", | ||
"elm/html": "1.0.0" | ||
}, | ||
"indirect": { | ||
"elm/json": "1.1.3", | ||
"elm/time": "1.0.0", | ||
"elm/url": "1.0.0", | ||
"elm/virtual-dom": "1.0.3" | ||
} | ||
}, | ||
"test-dependencies": { | ||
"direct": {}, | ||
"indirect": {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
-- Comments | ||
-- Functions that create elements take exactly 2 arguments | ||
-- fn_that_creates_elems [ls_of_attrs] [ls_of_DOM_nodes] | ||
-- 1. A list of attributes | ||
-- 2. A list of DOM Nodes | ||
-- One of the args can empty so we get this | ||
-- 1. h1 [] [ text "Photo Groove" ] | ||
-- 2. img [ src "1.jpeg" ] [] | ||
-- or even both empty | ||
-- br [] [] | ||
module PhotoGroove exposing (main) | ||
|
||
import Html exposing (div, h1, img, text) | ||
import Html.Attributes exposing (..) | ||
|
||
view model = | ||
div [ class "content" ] | ||
[h1 [] [text "Photo Groove" ] | ||
, div [ id "thumbnails" ] | ||
[ img [ src "http://elm-in-action.com/1.jpeg" ] [] | ||
, img [ src "http://elm-in-action.com/2.jpeg" ] [] | ||
, img [ src "http://elm-in-action.com/3.jpeg" ] [] | ||
] | ||
] | ||
|
||
main = | ||
view "no model yet" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Example 2-2. Type conversions | ||
|
||
package main | ||
|
||
import "fmt" | ||
|
||
// Immutable variables | ||
const cx int64 = 10 | ||
|
||
const ( | ||
idKey = "id" | ||
nameKey = "name" | ||
) | ||
const z = 20 * 10 | ||
|
||
func main() { | ||
|
||
var x int = 10 | ||
var y float64 = 30.2 | ||
var sum1 float64 = float64(x) + y | ||
var sum2 int = x + int(y) | ||
fmt.Println(sum1, sum2) | ||
|
||
var xx int = 10 | ||
var b byte = 100 | ||
var sum3 int = xx + int(b) | ||
var sum4 byte = byte(x) + b | ||
fmt.Println(sum3, sum4) | ||
|
||
// Go doesn’t provide a way to specify that a value calculated at runtime is | ||
x2 := 5 | ||
y2 := 10 | ||
const z = x2 + y2 | ||
|
||
const cy = "hello" | ||
fmt.Println(cx) | ||
fmt.Println(cy) | ||
cx = cx + 1 // this will not compile! | ||
cy = "bye" // this will not compile! | ||
|
||
} | ||
|
||
// Constants in Go are a way to give names to literals. | ||
// They can only hold values that the compiler can figure out at compile time. | ||
// | ||
// This means that they can be assigned: | ||
// • Numeric literals | ||
// • true and false | ||
// • Strings | ||
// • Runes | ||
// • The values returned by the built-in functions complex, real, imag, len, and cap | ||
// • Expressions that consist of operators and the preceding values |