Skip to content

Commit 6ed91c6

Browse files
Update clojurescript.md
1 parent 971433c commit 6ed91c6

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

docs/clojurescript.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
>
88
> It is not yet completely polished, but it is getting close. It does not yet have an integrated inline/on-page REPL yet. But it will soon. <br>
99
>
10-
> Please open an issue with your thoughts [at the re-freame repo](https://github.com/day8/re-frame/) or via twitter [here](https://twitter.com/wazound)
10+
> Please open an issue with your thoughts [at the re-frame repo](https://github.com/day8/re-frame/) or via twitter [here](https://twitter.com/wazound)
1111
>
1212
> Many Thanks!
1313
@@ -23,7 +23,7 @@ Clojure is a modern LISP.
2323

2424
Alan Kay once described LISP as "Maxwell's equations of software".
2525
Paul Graham believes LISP was a competitive advantage for his startup.
26-
Eric Raymmond said that learning LISP was profoundly enligtening and that knowing it would make you a better programmer for the rest of your days.
26+
Eric Raymond said that learning LISP was profoundly enlightening and that knowing it would make you a better programmer for the rest of your days.
2727

2828
In the 70s, 80s and 90s, the LISP community went through a washing machine phase of evolutionary churn.
2929
Innovation flourished, experiments happened, prototype ideas were tested and knowledge foliated.
@@ -255,7 +255,7 @@ Example list evaluations, involving symbols:
255255
|-------------------------|------------------------|--------------------------------------------------------|
256256
| `(inc 3)` | `4` | Step 1: evaluate each element of the list (there are two):<br>&nbsp;&nbsp;• the symbol `inc` is bound to a builtin function<br>&nbsp;&nbsp;• and `3` evaluates to `3`<br>Step 2: call the function with `3` as the argument.<br>The return value `4` |
257257
| `[5 (inc 6)]` | `[5 7]` | Evaluate each element of the vector. `5` evaluates to `5`.<br>Then, evaluating that 2nd element is a function call. |
258-
| `(+ 1 2)` | `3` | The symbol `+` is bound to a builin function.<br>And that function adds together its arguments |
258+
| `(+ 1 2)` | `3` | The symbol `+` is bound to a builtin function.<br>And that function adds together its arguments |
259259
| `(+ 1 2 3)` | `6` | Surprise! Turns out this function can handle a variable<br>number of arguments. |
260260
| `[1 (+ 1 2 3)]` | `[1 6]` | |
261261

@@ -293,7 +293,7 @@ Well, in your mind's eye, see this nested example as `(f arg1 arg2)` where:
293293
- `arg1` is `1`
294294
- `arg2` is `(inc 10)` <-- a nested form
295295

296-
To evaluate this form, you'll remember from the last section that it is a two step process. First, evaluate each of the three elements. So the execution trace will be:
296+
To evaluate this form, you'll remember from the last section that it is a two-step process. First, evaluate each of the three elements. So the execution trace will be:
297297

298298
- `+` will evaluate to the builtin function bound to that symbol
299299
- `1` evaluates to `1`
@@ -308,7 +308,7 @@ More:
308308
|------------------------|------------------------|-----------------------------------------------|
309309
| `(+ 3 (count [1 2]))` | `5` | Evaluation trace:<br>&nbsp;&nbsp;`+` is evaluated to a function<br>&nbsp;&nbsp;`3` is evaluated to `3`<br>&nbsp;&nbsp;`(count [1 2])` is evaluated as a function call which returns `2`<br>&nbsp;&nbsp;• call function with args `3` and `2`, which returns `5` |
310310
| `(= 2 (inc 1))` | `true` | `=` is a symbol which is bound to a builtin function.<br>You can guess what it does. |
311-
| `(= (inc 1) (dec 3))` | `true` | `dec` is bound to a bultin, and it decrements its arg by one |
311+
| `(= (inc 1) (dec 3))` | `true` | `dec` is bound to a builtin, and it decrements its arg by one |
312312

313313

314314
Evaluate these experiments yourself (any surprises?):
@@ -570,7 +570,7 @@ Consider these two:
570570

571571
Now, consider what is happening here:
572572
```clj
573-
(def my-inc (fn [a] (+ a 1))
573+
(def my-inc (fn [a] (+ a 1)))
574574
```
575575
That `fn` form will create a function, and then the `def` will bind it to the symbol `my-inc`. Two steps. Hey, we've just created our own `inc`.
576576
```clj
@@ -635,7 +635,7 @@ Define another:
635635
```clj
636636
(defn greet
637637
[username]
638-
(str "Hello " username)))
638+
(str "Hello " username))
639639
```
640640
`str` is a builtin function which turns each of its arguments into a string and concatenates them.
641641

@@ -705,11 +705,11 @@ XXX experiment with greet
705705

706706
<div class="cm-doc" data-cm-doc-no-eval-on-init>(greet "Noisy Neighbours" false)</div>
707707

708-
In this particular, we could have got away with no using a `let`, like this:
708+
In this particular, we could have got away with not using a `let`, like this:
709709
``` clj
710710
(defn greet
711711
[name friendly?]
712-
[:div (if friendly? "Hello " "Go away ") name)
712+
[:div (if friendly? "Hello " "Go away ") name])
713713
```
714714

715715
```clj
@@ -872,7 +872,7 @@ XXX Live coding here.
872872

873873
## `reduce`
874874

875-
In the functional world, `reduce` is part 600 pound gorilla, part swiss arm knife.
875+
In the functional world, `reduce` is part 600 pound gorilla, part swiss army knife.
876876

877877
It takes three arguments:
878878

@@ -988,7 +988,7 @@ Deeply nested forms, like this, are often rewritten using the `thread first` mac
988988
```clj
989989
(-> (+ 0 1) ; (+ 0 1)
990990
(+ 2) ; (+ (+ 0 1) 2)
991-
(+ 4))) ; (+ (+ (+ 0 1) 2) 4)
991+
(+ 4)) ; (+ (+ (+ 0 1) 2) 4)
992992
```
993993
`->` is a symbol and it is the first element in a form `(-> ...)`.
994994
So, this is a function call and the symbol `->` is bound to the function to be called, a bit
@@ -1031,7 +1031,7 @@ Work out the evaluation of:
10311031
:aa) ;; same as (:aa)
10321032
```
10331033

1034-
`->` belongs to a small family of marcos. Another one is the `thread last` macro `->>`. It operates the same way except it threads the value as the argument in the last position, not the first.
1034+
`->` belongs to a small family of macros. Another one is the `thread last` macro `->>`. It operates the same way except it threads the value as the argument in the last position, not the first.
10351035

10361036
## Thread Last Macro `->>`
10371037

@@ -1089,7 +1089,7 @@ you'll see a vector of three values ` [{:doors 2} {:doors 2, :seats 4} {:doors
10891089

10901090
Notice how `car1` is unchanged, even though we did an `assoc` into `car1` . Same with XXXXXXXXX
10911091

1092-
When you are used to imperative, in-place modification of data, it can initially be mysterfying as to how you can achieve anything. Rest assured, you can.
1092+
When you are used to imperative, in-place modification of data, it can initially be mystifying as to how you can achieve anything. Rest assured, you can.
10931093

10941094
More experiments. If we evaluate this:
10951095
```cljs

0 commit comments

Comments
 (0)