JuliaDynamics/Agents.jl

[FR] make the `@agent` macro define pretty printing as well

開放

#965 建立於 2024年2月3日

 (1 則留言) (0 個反應) (0 位負責人)Julia (146 個分叉)batch import
good first issuequality of life

倉庫指標

星標
 (904 顆星)
PR 合併指標
 (平均合併 1天 7小時) (30 天內合併 4 個 PR)

描述

Currently we have:

@agent struct SchellingAgent(GridAgent{2})
    mood::Bool # whether the agent is happy in its position
    group::Int # The group of the agent, determines mood as it interacts with neighbors
end

a = SchellingAgent(1, (1,1), true, 1)

which prints

SchellingAgent(1, (1, 1), true, 1)

wouldn't it be nice to have pretty printing by default, so that each field is printed in 1 line, along with its name, its type, and then = value ? I am sure this shouldn't be too difficult to do...?

貢獻者指南