Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update episodes from Literate.jl source files #71

Merged
merged 1 commit into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions episodes/01_Introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ This is captured the best by an analogy from [Sam Urmy](https://github.com/ElOce
> together quickly and easily.
>
> <p align="center">
> ![](https://global.discourse-cdn.com/business5/uploads/julialang/original/3X/5/2/52e63856ad9e23876cda4297a04171879fa625b4.jpeg){width="600" height="400" alt=""}
> ![](https://global.discourse-cdn.com/julialang/original/3X/5/2/52e63856ad9e23876cda4297a04171879fa625b4.jpeg){width="600" height="400" alt=""}
> </p>
>
> OK, sure. Toy trucks are like linear algebra, though, a common request, and
Expand All @@ -88,7 +88,7 @@ This is captured the best by an analogy from [Sam Urmy](https://github.com/ElOce
> wings? And it should be as easy to build and use as a basic dump truck?
>
> <p align="center">
> ![](https://global.discourse-cdn.com/business5/uploads/julialang/original/3X/2/8/2865d34fb35c181dc3c5c0f0b71915f31310269c.jpeg){ width="600" height="400" alt=""}
> ![](https://global.discourse-cdn.com/julialang/original/3X/2/8/2865d34fb35c181dc3c5c0f0b71915f31310269c.jpeg){ width="600" height="400" alt=""}
> </p>
>
> There’s a reason that only Lego ever made anything like Dr. Cyber’s Flying
Expand Down
2 changes: 1 addition & 1 deletion episodes/04_Using_the_package_manager.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ environment.
````
Status `~/projects/trebuchet/Project.toml`
[f6369f11] ForwardDiff v0.10.36
[295af30f] Revise v3.5.5
[295af30f] Revise v3.5.7
[98b73d46] Trebuchet v0.2.2

````
Expand Down
16 changes: 13 additions & 3 deletions episodes/05_Write_functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@ those that are not exported. What would the function call look like?
1. Both arguments are present, but `true` is presented without a keyword.
This throws a `MethodError: no method matching names(::Module, ::Bool)`
2. This is a __correct__ call.
3. This is also __correct__: you _can_ specify where the positional arguments
end with the `;`, but you do not have to.
4. Two arguments are present, but the keyword `all` is not assigned a
3. Two arguments are present, but the keyword `all` is not assigned a
value. This throws a
`MethodError: no method matching names(::Module, ::typeof(all))`
4. This is also __correct__: you _can_ specify where the positional arguments
end with the `;`, but you do not have to.
5. This is the __most correct__ answer.

::::::
Expand All @@ -118,6 +118,16 @@ Pkg.instantiate()

````
Activating project at `~/projects/trebuchet`
Precompiling project...
 ✓ OpenSSL_jll
 ✓ OpenSSL
 ✓ HTTP
 ✓ WebSockets
 ✓ WebIO
 ✓ JSExpr
 ✓ Trebuchet
7 dependencies successfully precompiled in 416 seconds. 160 already precompiled.
3 dependencies precompiled but different versions are currently loaded. Restart julia to access the new versions
Comment on lines +121 to +130
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This broke the build of the webpage: https://github.com/carpentries-incubator/julia-novice/actions/runs/6642649083/job/18047884810. Also, should the build be run also in PRs, to avoid having broken builds on main?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be nice, yeah, but we'd need to separate build from deploy for that, I guess


````

Expand Down
30 changes: 15 additions & 15 deletions episodes/07_Loops.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ Trebuchet( rand() * 500, rand() * pi/2 )

````output
2-element Trebuchet:
325.16857513243514
1.4214156882736535
199.20577943788413
1.3175676282878894
````

will give her a Trebuchet with a weight between 0 and 500 and a release angle between 0 and pi/2 radians at random.
Expand All @@ -121,9 +121,9 @@ distances = [shoot_distance(Trebuchet(rand() * 500, rand() * pi / 2), env) for _

````output
3-element Vector{Float64}:
95.34228401250319
116.82589218537548
0.6815707596179541
109.63015948619828
26.241893505479297
42.721289252273955
````

This is called an _array comprehension_.
Expand All @@ -138,16 +138,16 @@ distances = [(w,a) => shoot_distance(Trebuchet(w, a), env) for (w, a) in zip(wei

````output
10-element Vector{Pair{Tuple{Float64, Float64}, Float64}}:
(39.64972003383499, 1.4356297441010255) => 11.866149878931637
(164.42881179322788, 1.4640276154421406) => 22.174678100790018
(367.9434185012257, 1.4375026271475015) => 29.142976299251053
(137.99390039219506, 0.9643884432619938) => 84.81262654249787
(222.0515164410986, 0.4063767373305969) => 104.28193737621544
(436.7263816265339, 1.2139595368028047) => 68.51245438747303
(180.62981502392094, 0.966166690591184) => 90.05903638111702
(7.5342147342188355, 0.13669385275895293) => 0.6815707596179541
(317.4431655220148, 1.2250401309666004) => 64.69560256895292
(396.6491533236719, 0.12154258149162844) => 82.50509163157764
(190.20671680295277, 0.46833555853995784) => 105.35107143909875
(478.1865359891392, 0.5300556485613425) => 118.30720084397312
(486.93150499743587, 0.3266640654580006) => 109.46465880298848
(482.14935572302176, 0.12719150178861877) => 84.4818142924443
(19.24228958100732, 1.1311868010145723) => 3.0834927704117057
(233.70715374384997, 0.9844292611959172) => 92.48538338520068
(322.8906658023918, 0.3793433438873054) => 110.49554634124097
(70.71586061650947, 1.3112085094572539) => 33.712397304286064
(369.04715755142337, 0.7897355893853809) => 112.25274271811487
(417.9989625732521, 1.3286071027399737) => 47.89370694935854
````

### Gradient descent
Expand Down
2 changes: 1 addition & 1 deletion episodes/10_Adding_tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ end
````

````output
Test.DefaultTestSet("Test arithmetic equalities", Any[], 1, false, false, true, 1.694703469038899e9, 1.694703469081385e9, false)
Test.DefaultTestSet("Test arithmetic equalities", Any[], 1, false, false, true, 1.698245666140703e9, 1.698245666189045e9, false)
````

With this Melissa can run her test using the pkg mode of the REPL:
Expand Down