Skip to content

Commit 3b22107

Browse files
committed
Update README
1 parent d3adf7d commit 3b22107

1 file changed

Lines changed: 43 additions & 43 deletions

File tree

README.md

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -43,56 +43,56 @@ julia> Pkg.add("SimJulia")
4343
* Version 0.4 only supports Julia v0.6 and above. It is a complete rewrite: more julian and less pythonic.
4444
* The discrete event features are on par with version 0.3 and following features are added:
4545
* Scheduling of events can be done with `Base.Dates.Datetime` and `Base.Dates.Period`:
46-
```julia
47-
using SimJulia
48-
using Base.Dates
49-
50-
function datetimetest(sim::Simulation)
51-
println(nowDatetime(sim))
52-
yield(Timeout(sim, Day(2)))
53-
println(nowDatetime(sim))
54-
end
55-
56-
datetime = now()
57-
sim = Simulation(datetime)
58-
@process datetimetest(sim)
59-
run(sim, datetime+Month(3))
60-
```
61-
* Two ways of making `Processes` are provided:
62-
- using the existing concept of `Tasks`:
6346
```julia
64-
function fibonnaci(sim::Simulation)
65-
a = 0.0
66-
b = 1.0
67-
while true
68-
println(now(sim), ": ", a)
69-
yield(Timeout(sim, 1))
70-
a, b = b, a+b
71-
end
47+
using SimJulia
48+
using Base.Dates
49+
50+
function datetimetest(sim::Simulation)
51+
println(nowDatetime(sim))
52+
yield(Timeout(sim, Day(2)))
53+
println(nowDatetime(sim))
7254
end
7355

74-
sim = Simulation()
75-
@process fibonnaci(sim)
76-
run(sim, 10)
56+
datetime = now()
57+
sim = Simulation(datetime)
58+
@process datetimetest(sim)
59+
run(sim, datetime+Month(3))
7760
```
61+
* Two ways of making `Processes` are provided:
62+
- using the existing concept of `Tasks`:
63+
```julia
64+
function fibonnaci(sim::Simulation)
65+
a = 0.0
66+
b = 1.0
67+
while true
68+
println(now(sim), ": ", a)
69+
yield(Timeout(sim, 1))
70+
a, b = b, a+b
71+
end
72+
end
73+
74+
sim = Simulation()
75+
@process fibonnaci(sim)
76+
run(sim, 10)
77+
```
7878
- using a novel finite-statemachine approach:
79-
```julia
80-
using ResumableFunctions
81-
82-
@resumable function fibonnaci(sim::Simulation)
83-
a = 0.0
84-
b = 1.0
85-
while true
86-
println(now(sim), ": ", a)
87-
@yield Timeout(sim, 1)
88-
a, b = b, a+b
79+
```julia
80+
using ResumableFunctions
81+
82+
@resumable function fibonnaci(sim::Simulation)
83+
a = 0.0
84+
b = 1.0
85+
while true
86+
println(now(sim), ": ", a)
87+
@yield Timeout(sim, 1)
88+
a, b = b, a+b
89+
end
8990
end
90-
end
9191
92-
sim = Simulation()
93-
@coroutine fibonnaci(sim)
94-
run(sim, 10)
95-
```
92+
sim = Simulation()
93+
@coroutine fibonnaci(sim)
94+
run(sim, 10)
95+
```
9696
* Documentation is automated with [Documenter.jl](https://github.com/JuliaDocs/Documenter.jl). (WIP)
9797

9898

0 commit comments

Comments
 (0)