h-Klok / StatsWithJuliaBook

https://statisticswithjulia.org/
MIT License
1.08k stars 279 forks source link

Code cleanup and update #10

Closed VincentTam closed 5 years ago

VincentTam commented 5 years ago

Partially resolve #8 (indentation undecided), resolve #9, resolve #4 & #11 globally, replace some deprecated code in the first chapter. (@pyimport, o[:s])

The following

https://github.com/h-Klok/StatsWithJuliaBook/blob/ea76f4599ce57abd77c5bd3ab1b68f567b4bd901/1_chapter/lcg.jl#L9-L13

gives an error.

A minimal example to illustrate this would be

julia> x = 1; for i in 1:10; x = 3; print(x, " "); end; println(x)
3 3 3 3 3 3 3 3 3 3 1
julia> x = 1; for i in 1:10; print(x, " "); end; println(x)
1 1 1 1 1 1 1 1 1 1 1
julia> x = 1; for i in 1:10; x += 1; end; println(x)
ERROR: UndefVarError: x not defined
Stacktrace:
 [1] top-level scope at ./REPL[17]:1 [inlined]
 [2] top-level scope at ./none:0

To fix this, 006d6c8 is created.

https://github.com/h-Klok/StatsWithJuliaBook/blob/006d6c812211817fdb4c61990fa3a174f67be5c5/1_chapter/lcg.jl#L9-L13

In some plots (1_chapter/graph.jl, 1_chapter/imageProcessing.jl & 1_chapter/imageProcessing.jl), I've replaced the add_subplot with matplotlib's object oriented API. There should be more, but I'm leaving this aside for the moment.

h-Klok commented 5 years ago

Thanks very much Vincent