AlgebraicJulia / AlgebraicJulia/Catlab.jl

`@formula` macro like `@program`

Aberta
#150 0 comentários 0 reações 0 responsáveis Ver no GitHub
enhancement
Linguagem predominante
Julia
Estrelas
724
Forks
73
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

I think we should have a macro for writing formulas within the scope of a presentation. When you do

```julia
@present P (FreeSMCwithDiagonals) begin
T::Ob
f::Hom(T,T)
end

@program P (x::T) begin
y = f(x)
return y,y
end
```

Catlab knows that `f` is referring to the generating morphism in `P` that is named `:f`. If you want to do a similar thing with the algebraic expression api, you would need to do

```julia
T, f = generators(P, [:T, :f])
compose(mcopy(T), f)
```

In that case the T,f escape into the julia namespace as julia variables.

It would be nice to do

```julia
@formula P begin
compose(mcopy(T), f)
end
```

and have Catlab recognize that the `T,f` variables should be the generators from `P`.

Guia de contribuição

Abrir o guia de contribuição

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.