AlgebraicJulia / AlgebraicJulia/StockFlow.jl

Implement recursive columnaccess and rowaccess

Aperta
#44 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Julia
Stelle
82
Fork
9
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

StockAndFlowF is currently stored as a NamedTuple of ACSetTables. NamedTuples such that T <: NTuple{N, AbstractVector} implement columnaccess, and ACSetTable implements column access, but this doesn't work recursively; that is, when accessing the tables of a StockAndFlowF, one columnaccess is false. If I understand correctly, though, it wouldn't be wrong to define it to be true for NamedTuples of ACSetTables or ACSetTables of NamedTuples; it simply means that accessing it is O(1), and we can just define columns(x) = x.

Intention is to be able to manipulate StockAndFlowF tables using [Table Operations](https://github.com/JuliaData/TableOperations.jl).

It may fall on Catlab.DenseACSets to implement this instead.

I've implemented a bit of a workaround which works specifically with NamedTuples containing ACSetTables:

const NamedACSetTable = NamedTuple{names, T} where {names, T <: NTuple{N, ACSetTable} where N}
Tables.columnaccess(x::NamedACSetTable) = true
Tables.columns(x::NamedACSetTable) = x

Tables.rowaccess(x::NamedACSetTable) = true

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.