Giter Site home page Giter Site logo

Comments (3)

epatters avatar epatters commented on May 27, 2024

First, a comment about design. Coincidentally, Mike Shulman has recently published a preprint about a type theory for symmetric monoidal categories. There is a lot going on there, much of which I haven't fully understood, but the discussion in Section 1 is good food for thought.

One relevant issue that Shulman raises is how to deal with monoidal products in the codomain. Suppose you have morphisms f: W -> X x Y and g: X x Y -> Z. How do you write the composite of f with g? Shulman proposes an indexing notation inspired by Sweedler notation, but I think in Julia it will be more natural to write

x, y = f(w)
g(x,y)

(in the spirit of what Shulman calls "covariables") or simply

g(f(w))

Ordinarily, in Julia, only one of these invocations would be allowed. This is the difference between g(x,y) and g((x,y)). For the purpose of parsing Julia programs into morphisms, I think we should allow both. We can do so unambiguously because the morphisms are statically typed. If I understand correctly, Shulman also allows both styles of composition, albeit using the Sweedler notation (see the last two term constructors in Fig 4).

Apart from this subtlety about multiple outputs, and a similar one about nullary outputs (monoidal units), I think we can stick to the ordinary semantics of Julia code.

from catlab.jl.

epatters avatar epatters commented on May 27, 2024

One way to implement this is to rewrite the Julia program so that:

  1. variables carry ports in a wiring diagram
  2. function calls create a new box and return its output ports.

The program can then be executed by the Julia run-time and the result will be a wiring diagram.

from catlab.jl.

epatters avatar epatters commented on May 27, 2024

This issue is now mostly resolved. The only outstanding feature is recovering morphism expressions from traditional expression trees (Formula), but I'll defer that to another issue.

from catlab.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.