Skip to content

Commit ed3a326

Browse files
committed
Apply many of Patrik's suggestions for Introduction
Spelling, naming, etc
1 parent 1aed1c7 commit ed3a326

File tree

3 files changed

+35
-39
lines changed

3 files changed

+35
-39
lines changed

Book/build.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,17 @@ def build_index(sources):
9797

9898
sources = [
9999
("Introduction", [
100-
("Introduction'", "Physics/src/Introduction/Introduction.lhs"),
100+
(">> Start here <<", "Physics/src/Introduction/Introduction.lhs"),
101101
]),
102102
("Calculus", [
103103
("Introduction", "Physics/src/Calculus/Intro.lhs"),
104104
("Function expressions", "Physics/src/Calculus/FunExpr.lhs"),
105105
("Differential calculus", "Physics/src/Calculus/DifferentialCalc.lhs"),
106106
("Integral calculus", "Physics/src/Calculus/IntegralCalc.lhs"),
107-
("Visualization", "Physics/src/Calculus/VisVerApp.lhs"),
107+
("Plotting graphs", "Physics/src/Calculus/VisVerApp.lhs"),
108108
]),
109-
("Vectors", [
110-
("Vector", "Physics/src/Vector/Vector.lhs")
109+
("Linear algebra", [
110+
("Vectors", "Physics/src/Vector/Vector.lhs")
111111
]),
112112
("Dimensions", [
113113
("Introduction", "Physics/src/Dimensions/Intro.lhs"),
@@ -116,15 +116,14 @@ def build_index(sources):
116116
"Physics/src/Dimensions/ValueLevel/Test.lhs"),
117117
("Type-level dimensions", "Physics/src/Dimensions/TypeLevel.lhs"),
118118
("Quantities", "Physics/src/Dimensions/Quantity.lhs"),
119-
("Testing of Quantity",
119+
("Testing of Quantities",
120120
"Physics/src/Dimensions/Quantity/Test.lhs"),
121121
("Usage", "Physics/src/Dimensions/Usage.lhs"),
122-
]),
123-
("Examples", [
124-
("Gungbräda", "Physics/src/Examples/Gungbraeda.lhs"),
125-
("krafter på lådor", "Physics/src/Examples/krafter_pa_lador.lhs"),
126-
127122
])
123+
# ("Examples", [
124+
# ("Gungbräda", "Physics/src/Examples/Gungbraeda.lhs"),
125+
# ("krafter på lådor", "Physics/src/Examples/krafter_pa_lador.lhs"),
126+
# ])
128127

129128
]
130129

Physics/src/Calculus/FunExpr.lhs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ Try modifying `FunExpr` to derive `Show`, so that our expressions can be printed
157157

158158
< deriving Eq, Show
159159

160-
Consider now how GHCI prints out a function expression we create
160+
Consider now how GHCi prints out a function expression we create
161161

162162
< ghci> carAccel = Const 20
163163
< ghci> carSpeed = Const 50 :+ carAccel :* Id

Physics/src/Introduction/Introduction.lhs

Lines changed: 25 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,18 @@
1-
> module Introduction.Introduction where
2-
>
3-
> message = "Greetings!"
4-
5-
About this tutorial
1+
About this book
62
======================================================================
73

84
You've arrived at **Learn You a Physics for Great Good**,
95
the #1 stop for all your beginner-to-intermediate needs of learning
10-
**Physics** through the use of **Domain Specifc Languages**
11-
(hereinafter DSLs (mostly but not always)).
6+
**Physics** through the use of **Domain Specific Languages**
7+
(DSLs).
128

13-
This book was written as a [bachelor's thesis
9+
This book was written as a [BSc thesis
1410
project](https://github.com/DSLsofMath/BScProj2018) at Chalmers
1511
University of Technology as an offshoot of a bachelor's level elective
1612
course [*Domain Specific Languages of
1713
Mathematics*](https://github.com/DSLsofMath/DSLsofMath). The goal of
18-
the the project and the reason for the existance of this book, is to
19-
help primarily CS students learn physics better. We think that the use
14+
the the project and the reason for the existence of this book, is to
15+
help (primarily CS) students learn physics better. We think that the use
2016
of domain specific languages to teach the subject will help set these
2117
students in the right mindset to learn physics efficiently and
2218
properly. An observed problem has been that students base their mental
@@ -33,9 +29,9 @@ relief in between all the dramatic definitions.
3329

3430
In this book, we will study physics through the lens of DSLs. We will
3531
need to pay close attention to definitions, throughly ponder any
36-
non-trivial syntax, and prove that the things we do are actually
37-
correct. The areas covered include such things as: dimensional
38-
analysis, vectors, calculus, and more!
32+
non-trivial syntax, and verify (via tests or proofs) that the things
33+
we do are actually correct. The areas covered include such things as:
34+
dimensional analysis, vectors, calculus, and more!
3935

4036
The book is aimed at you who have some knowledge of
4137
[Haskell](https://www.haskell.org/). If you know what a `class` and an
@@ -51,13 +47,13 @@ In general, a domain specific language is simply a computer language
5147
for a specific domain. It's NOT a synonym for
5248
[jargon](http://www.catb.org/jargon/html/online-preface.html)! DSLs
5349
can be specialized for markup, like
54-
[*HTML*](https://en.wikipedia.org/wiki/HTML); for modeling, like
50+
[*HTML*](https://en.wikipedia.org/wiki/HTML); for modelling, like
5551
[*EBNF*](https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_form);
56-
for programming, like
52+
for shell scripting, like
5753
[*Bash*](https://en.wikipedia.org/wiki/Bash_%28Unix_shell%29); and
5854
more.
5955

60-
The languages we will construct will mostly concern modeling of
56+
The languages we will construct will mostly concern modelling of
6157
physics and mathematics. We will create data structures in Haskell to
6258
represent the same physics calculations that we write on paper, in
6359
such a way that we can write functions to, for example, analyze the
@@ -72,15 +68,15 @@ $$x + x$$
7268

7369
$$x$$
7470

75-
$$x + x + x + x$$
71+
$$(x + x) + (x + x)$$
7672

77-
When implementing a DSL, we typically start with modeling the
78-
syntax. Let's first declara a data type for the language
73+
When implementing a DSL, we typically start with modelling the
74+
syntax. Let's first declare a data type for the language
7975

8076
> data Expr
8177

8278
Then we interpret the textual description of the language. "Our
83-
language will consist expressions of a single variable and
79+
language will consist of expressions of a single variable and
8480
addition". Ok, so an expression can be one of two things then: a
8581
single variable
8682

@@ -90,14 +86,15 @@ or two expressions added together.
9086

9187
> | Add Expr Expr
9288

93-
And that's it, kind of! A DSL without any associated functions for
94-
validation, symbolic manipulation, evaluation, or somesuch, is really
95-
no DSL at all! We must DO something with it, or there is no point!
89+
And that's it, kind of! However, a DSL without any associated
90+
functions for validation, symbolic manipulation, evaluation, or
91+
somesuch, is really no DSL at all! We must DO something with it, or
92+
there is no point!
9693

9794
One thing we can do with expressions such as these, is compare whether
9895
two of them are equal. Even without using any numbers, we can test
9996
this by simply counting the $x$s! If both expressions contain the same
100-
amount of $x$s, they will be equal!
97+
number of $x$s, they will be equal!
10198

10299
> eq :: Expr -> Expr -> Bool
103100
> eq e1 e2 = count e1 == count e2
@@ -110,7 +107,7 @@ We can now test whether our expressions are equal.
110107
< True
111108

112109
And NOW that's it (if we want to stop here)! This is a completely
113-
valid (but boring) DSL. We've modeled the syntax, and added a function
110+
valid (but boring) DSL. We've modelled the syntax, and added a function
114111
that operates symbolically on our language. This is a very small and
115112
simple DSL, and you've likely done something similar before without
116113
even realizing you were constructing a DSL. It can really be that
@@ -131,7 +128,7 @@ What you need to dive in
131128
======================================================================
132129

133130
To just follow along and implement the same stuff we do, a single
134-
document loaded into GHCI will do. For this, you just need to install the
131+
document loaded into GHCi will do. For this, you just need to install the
135132
[Haskell Platform](https://www.haskell.org/platform/).
136133

137134
If you want to automatically install any required dependencies, like
@@ -143,7 +140,7 @@ what you'll need. With Stack installed and [our repository
143140
cloned](https://github.com/DSLsofMath/BScProj2018), enter the
144141
`Physics` directory and type `stack build`. Stack should now download
145142
and compile all necessary dependencies, such that they are avaiable
146-
when you load a module in GHCI.
143+
when you load a module in GHCi.
147144

148145

149146

@@ -158,7 +155,7 @@ attention.
158155
If you still don't really get what DSLs are all about, try reading the
159156
["notes" (almost a full book really) for the course on DSLs of math at
160157
Chalmers](https://github.com/DSLsofMath/DSLsofMath/tree/master/L/snapshots). If
161-
you're studying at Chalmers, even better to actually take the course!
158+
you're studying at Chalmers, it is even better to actually take the course!
162159

163160
If there's some part of the material that you still think is unclear
164161
(or maybe even wrong? Blasphemy!), please [open an issue on the github

0 commit comments

Comments
 (0)