Code Monkey home page Code Monkey logo

Comments (9)

nsbgn avatar nsbgn commented on June 18, 2024

source label : Type would be better, because a data input might source its input from either another transformation or from an actual data source. Or, perhaps clearer, input label : Type.

from transforge.

nsbgn avatar nsbgn commented on June 18, 2024

For readability, you could use a synonym like Contour = R2(Ord, Reg) to say source 3 : Contour.

from transforge.

nsbgn avatar nsbgn commented on June 18, 2024

In fact, the source keyword is probably not the best choice; it is long and may be read as a regular operation. A special symbol like # is more appropriate, or we could leave it away completely and understand any number as a source.

The shortest notation would be to do Type number. Then using just Type would be an anonymous source, and using just number would be just a reference to a source without typing it (as the type may have been already fixed somewhere else). Example:

size R1(Obj) 1
size R1(Obj)
size 1

Or, more readable:

size R1(Obj) #1
size R1(Obj)
size #1

However, this notation would not generalize to the ability to type non-source expressions inline. That's why I prefer something like:

size (#1 : R1(Obj))
size #1

Only the notation for an anonymous source remains to be decided, because I think size (# : R1(Obj)) looks awkward. Perhaps
size (* : R1(Obj)) or size (#? : R1(Obj))?

from transforge.

nsbgn avatar nsbgn commented on June 18, 2024

Even though size (# : R1(Obj)) looks awkward, both the explanation and the implementation would be simpler, so that's what we'll go with.

Also, the ; semicolon operator would be useful for resetting the stack. It would enable us to write something like #1 : Type; f #1 #1 --- in other words, you could define the types of input sources before using them.

from transforge.

nsbgn avatar nsbgn commented on June 18, 2024

For maximum correspondence between Python code and parsed expressions, I would suggest @ or ^ as an alternative to the type annotation symbol, :, and to use either None or ... for unlabelled sources and plain integers for labelled sources.

Or perhaps really using the special 'source' keyword is most straightforward and most explicit. Compare:

(((select inrel) (source 1 : R3a(Obj, Reg, Nom))) (source : R1(Obj)))

to:

(((select inrel) (1 : R3a(Obj, Reg, Nom))) (... : R1(Obj)))

The latter is shorter, but the former communicates intent much better. However, in the Python version, the other version is preferable:

select(inrel, Source(R3a(Obj, Reg, Nom), 1), Source(R1(Obj)))
select(inrel, 1 @ R3a(Obj, Reg, Nom), ... @ R1(Obj))

from transforge.

nsbgn avatar nsbgn commented on June 18, 2024

I think it's best to use - or + for shortcuts rather than ~, as we can use the unary version for anonymous sources and the binary one for labelled sources. As before:

select(inrel, Source(R3a(Obj, Reg, Nom), 1), Source(R1(Obj)))
select(inrel, 1 -R3a(Obj, Reg, Nom), -R1(Obj))
select(inrel, 1 +R3a(Obj, Reg, Nom), +R1(Obj))

from transforge.

nsbgn avatar nsbgn commented on June 18, 2024

In commit 084f591, sources started using integer labels internally, too.

from transforge.

nsbgn avatar nsbgn commented on June 18, 2024

Use square brackets for types? This would make graphs easier to read, would be consistent with Python's typing module, and would make expressions easier to read too.

from transforge.

nsbgn avatar nsbgn commented on June 18, 2024

The new notation is now used for cct, see quangis/quangis-workflow@36d1f8f

Given that the solution to issue #72 will require that labels are only meaningful during the parsing stage, we no longer need to worry about Python-compatible notation for labelling. ~T will indicate a source; a number will indicate a source that is to be replaced by another expression (possibly a source expression) during parsing.
With that, I think this issue can be closed.

from transforge.

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.