use quarto, not Pluto to render pages
This commit is contained in:
@@ -64,11 +64,9 @@ Variable names can be reused, as here, where we redefine `x`:
|
||||
x = 2
|
||||
```
|
||||
|
||||
```julia; echo=false
|
||||
note("""
|
||||
The `Pluto` interface for `Julia` is idiosyncratic, as variables are *reactive*. This interface allows changes to a variable `x` to propogate to all other cells referring to `x`. Consequently, the variable name can only be assigned *once* per notebook **unless** the name is in some other namespace, which can be arranged by including the assignment inside a function or a `let` block.
|
||||
""")
|
||||
```
|
||||
!!! note
|
||||
The `Pluto` interface for `Julia` is idiosyncratic, as variables are *reactive*. This interface allows changes to a variable `x` to propogate to all other cells referring to `x`. Consequently, the variable name can only be assigned *once* per notebook **unless** the name is in some other namespace, which can be arranged by including the assignment inside a function or a `let` block.
|
||||
|
||||
|
||||
|
||||
`Julia` is referred to as a "dynamic language" which means (in most
|
||||
@@ -95,7 +93,7 @@ bottom = 5 - 6/7
|
||||
top/bottom
|
||||
```
|
||||
|
||||
#### Examples
|
||||
### Examples
|
||||
|
||||
##### Example
|
||||
|
||||
@@ -197,27 +195,22 @@ the `Main` module. `Julia` looks for variables in this module when it
|
||||
encounters an expression and the value is substituted. Other uses, such as when variables are defined within a function, involve different contexts which may not be
|
||||
visible within the `Main` module.
|
||||
|
||||
```julia; echo=false;
|
||||
note("""
|
||||
The `varinfo` function will list the variables currently defined in the
|
||||
main workspace. There is no mechanism to delete a single variable.
|
||||
""")
|
||||
```
|
||||
!!! note
|
||||
The `varinfo` function will list the variables currently defined in the
|
||||
main workspace. There is no mechanism to delete a single variable.
|
||||
|
||||
```julia; echo=false;
|
||||
alert("""
|
||||
**Shooting oneselves in the foot.** `Julia` allows us to locally
|
||||
redefine variables that are built in, such as the value for `pi` or
|
||||
the function object assigned to `sin`. For example, this is a
|
||||
perfectly valid command `sin=3`. However, it will overwrite the
|
||||
typical value of `sin` so that `sin(3)` will be an error. At the terminal, the
|
||||
binding to `sin` occurs in the `Main` module. This shadows that
|
||||
value of `sin` bound in the `Base` module. Even if redefined in
|
||||
`Main`, the value in base can be used by fully qualifying the name,
|
||||
as in `Base.sin(pi)`. This uses the notation
|
||||
`module_name.variable_name` to look up a binding in a module.
|
||||
""")
|
||||
```
|
||||
!!! warning
|
||||
**Shooting oneselves in the foot.** `Julia` allows us to
|
||||
locally redefine variables that are built in, such as the value
|
||||
for `pi` or the function object assigned to `sin`. For example,
|
||||
this is a perfectly valid command `sin=3`. However, it will
|
||||
overwrite the typical value of `sin` so that `sin(3)` will be an
|
||||
error. At the terminal, the binding to `sin` occurs in the `Main`
|
||||
module. This shadows that value of `sin` bound in the `Base`
|
||||
module. Even if redefined in `Main`, the value in base can be used
|
||||
by fully qualifying the name, as in `Base.sin(pi)`. This uses the
|
||||
notation `module_name.variable_name` to look up a binding in a
|
||||
module.
|
||||
|
||||
## Variable names
|
||||
|
||||
@@ -268,17 +261,12 @@ For example, we could have defined `theta` (`\theta[tab]`) and `v0` (`v\_0[tab]`
|
||||
θ = 45; v₀ = 200
|
||||
```
|
||||
|
||||
These notes often use Unicode alternatives to avoid the `Pluto` requirement of a single use of assigning to a variable name in a notebook without placing the assignment in a `let` block or a function body.
|
||||
!!! note "Unicode"
|
||||
These notes can be presented as HTML files *or* as `Pluto` notebooks. They often use Unicode alternatives to avoid the `Pluto` requirement of a single use of assigning to a variable name in a notebook without placing the assignment in a `let` block or a function body.
|
||||
|
||||
|
||||
```julia; echo=false;
|
||||
alert("""
|
||||
There is even support for tab-completion of
|
||||
[emojis](https://github.com/JuliaLang/julia/blob/master/stdlib/REPL/src/emoji_symbols.jl)
|
||||
such as `\\:snowman:[tab]` or `\\:koala:[tab]`
|
||||
|
||||
""")
|
||||
```
|
||||
!!! note "Emojis"
|
||||
There is even support for tab-completion of [emojis](https://github.com/JuliaLang/julia/blob/master/stdlib/REPL/src/emoji_symbols.jl) such as `\\:snowman:[tab]` or `\\:koala:[tab]`
|
||||
|
||||
##### Example
|
||||
|
||||
@@ -404,8 +392,8 @@ What is the result of the above?
|
||||
p, q = 0.25, 0.2;
|
||||
top = p - q;
|
||||
bottom = sqrt(p*(1-p));
|
||||
ans = top/bottom;
|
||||
numericq(ans)
|
||||
answ = top/bottom;
|
||||
numericq(answ)
|
||||
```
|
||||
|
||||
###### Question
|
||||
@@ -433,8 +421,8 @@ q"some_really_long_name_that_is_no_fun_to_type",
|
||||
q"aMiXeDcAsEnAmE",
|
||||
q"fahrenheit451"
|
||||
]
|
||||
ans = 1
|
||||
radioq(choices, ans)
|
||||
answ = 1
|
||||
radioq(choices, answ)
|
||||
```
|
||||
|
||||
|
||||
@@ -445,8 +433,8 @@ Which of these symbols is one of `Julia`'s built-in math constants?
|
||||
|
||||
```julia; hold=true; echo=false;
|
||||
choices = [q"pi", q"oo", q"E", q"I"]
|
||||
ans = 1
|
||||
radioq(choices, ans)
|
||||
answ = 1
|
||||
radioq(choices, answ)
|
||||
```
|
||||
|
||||
|
||||
@@ -464,8 +452,8 @@ choices=[
|
||||
q"\delta[tab] = 1/10",
|
||||
q"delta[tab] = 1/10",
|
||||
q"$\\delta$ = 1/10"]
|
||||
ans = 1
|
||||
radioq(choices, ans)
|
||||
answ = 1
|
||||
radioq(choices, answ)
|
||||
```
|
||||
|
||||
|
||||
@@ -478,8 +466,8 @@ choices = [
|
||||
q"a=1, b=2, c=3",
|
||||
q"a,b,c = 1,2,3",
|
||||
q"a=1; b=2; c=3"]
|
||||
ans = 1
|
||||
radioq(choices, ans)
|
||||
answ = 1
|
||||
radioq(choices, answ)
|
||||
```
|
||||
|
||||
###### Question
|
||||
@@ -497,6 +485,6 @@ choices = ["Assign all three variables at once to a value of `3`",
|
||||
"Create ``3`` linked values that will stay synced when any value changes",
|
||||
"Throw an error"
|
||||
]
|
||||
ans = 1
|
||||
radioq(choices, ans)
|
||||
answ = 1
|
||||
radioq(choices, answ)
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user