Skip to content

Commit

Permalink
use mutable named tuples
Browse files Browse the repository at this point in the history
  • Loading branch information
Devetak committed May 6, 2024
1 parent 5c36235 commit 2bd4574
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819"
JuliaFormatter = "98e50ef6-434e-11e9-1051-2b60c6c9e899"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
MAT = "23992714-dd62-5051-b70f-ba57cb901cac"
NamedTupleTools = "d9ec5142-1e00-5aa0-9d6a-321866360f50"
MutableNamedTuples = "af6c499f-54b4-48cc-bbd2-094bba7533c7"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand All @@ -22,6 +22,6 @@ FileIO = "1.16"
JLD2 = "0.4"
JuliaFormatter = "1.0.56"
MAT = "0.10"
NamedTupleTools = "0.14"
MutableNamedTuples = "0.1.3"
StatsBase = "0.34"
julia = "1.9"
2 changes: 1 addition & 1 deletion src/model_init/agents.jl
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ This is a Model type. It is used to store all the agents of the economy.
- `rotw`: RestOfTheWorld
- `agg`: Aggregates
"""
struct Model
mutable struct Model
w_act::AbstractWorkers
w_inact::AbstractWorkers
firms::AbstractFirms
Expand Down
4 changes: 2 additions & 2 deletions src/model_init/init.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using NamedTupleTools
using MutableNamedTuples
recursive_namedtuple(x::Any) = x
recursive_namedtuple(d::Dict) = namedtuple(Dict(k => recursive_namedtuple(v) for (k, v) in d))
recursive_namedtuple(d::Dict) = MutableNamedTuple(;Dict(k => recursive_namedtuple(v) for (k, v) in d)...)

"""
initialise_model(parameters, initial_conditions, T, typeInt = Int64, typeFloat = Float64)
Expand Down

0 comments on commit 2bd4574

Please sign in to comment.