# A user interface for GLC

Before programming, is better to play first!

Really, not a joke, a new programming environment needs a lot of motivation and playing is a way to build some. Also, by playing we start to understand more, get all sorts of gut feelings and start collaborate with others.

As a first step towards programming with distributed GLC, a sort of playful gui seems attainable. Should be open source, of course.

Further I describe what kind of gui would like to have. But before that, just a few words.

1. Recall that we want to play with GLC and chemlambda, at this moment, therefore the gui should be done with humans first, computers 2nd frame of mind.

2.  As we shall see, if this project starts to  pick momentum, there will a stream of ideas about how to really program with distributed GLC

3. But for the moment, forget about actors and asynchronous computation and let’s stick to GLC and chemlambda.

Here is how I see it, in the next figure. Which is btw probably not  pretty. It is very important to be pretty and simple, something not obvious to achieve, but desired.

You can click on the figure to make it bigger.

The numbers in blue are for explanations.

So, what do we see? A window with some buttons.

The gui has some drawing related capabilities, like (following the blue numbers)

1)  select some nodes and arrows and form a group with them

2) deselect the group

3) magnify ; or magnify the selection, or put in front the selection, with the rest in the background

4) about how to draw arrows: if you choose this then arrows can cross (but see the problems from 14) and 15) )  and they try to be as straight as possible

5) about how to draw arrows: if you choose this then arrows are like in a kind of 2.5 dimensions; also they are not straight (in the euclidean sense) but like electronic circuits (i.e. straight in some Manhattan distance)

6) connect two arrows (by selecting the button and clicking on them

7) cut an arrow into two half arrows; delete arrow; delete node

Now, it’s not obvious how to well draw the arrows:

14) they should avoid the nodes , but they should also be as straight as possible, according to the choices made at 4) 5)

15) the arrow > should be positioned far from nodes and other arrows

We should be able to click on a node of the graph and move it with the mouse, and the gui should keep the connectivities.

The gui also has some basic graphical bricks, which depend on the formalism we use:

13) in the figure the chemlambda is chosen, which offers the 4 nodes (or maybe even the dilation node), arrows and loops. These should be buttons, click on one node and move it into the main window. The gui should propose connectivity variants, based on proximity with other available nodes. This should work like in a chemistry drawing program.

Important:

• if chemlambda is chosen at 13), then the list of moves, reductions, macros, i.e. 8) 9) 10) changes to be compatible with chemlambda
• and if another choice is made, like GLC or tibit, then the gui should be able to convert the graph from the main window in the respective formalism!
• in particular, if you don’t like the aspect of the nodes, then you should be free to change their look. For example, I’ve done this with chemlambda, where there are two notations used:

11) there is also the possibility to use cores. Cores are inputs/outputs from Distributed GLC, but let’s forget this for the moment. We discuss later about this.

12) this is a way to draw graphs which represent lambda calculus terms. The gui has a windows where we write a lambda term and the program converts it into a graph, by running the algorithm described here (for GLC, but same for chemlambda).

________________________________

Before continuing with the other buttons, let’s look a bit at the first figure. We see in the TEXT window $(\lambda x . xx)(\lambda x . xx)$ and we see a graph in the main figure.

Are they related anyways? Yes, look at the post about “metabolism of loops“.  You can see that graph (but it is made now with the more recent drawing convention) in the figure which explains how that lambda calculus combinator reduces in chemlambda. I reproduce that figure here:

_________________________________

Let’s go back to the buttons 8) 9) 10)

8) If you click this then you get the list of moves (from chemlambda for example, if at 13) you picked chemlambda). You click on a move, then you see on the graph the places where you can apply the move (they shine, or they are bigger, or something), or maybe as you hover the the mouse over the graph the places where this move can be applied are highlighted. Of course, this should work only for the “+” direction of the moves. In the opposite sense, should  work after you pick, for example, a pair of arrows (and then you can apply there, by clicking, a (beta-) move).

I picked this particular graph because it has the property that some of its nodes  are part of several different patterns where different moves can apply. (In the last figure you see this, because the patterns and the possible moves are described there).

9) two ways to use this: either you click on a highlighted pattern (of a move, selected with 8)) and the gui does the move for you (which involves redrawing the graph according to the graphical constraints described previously). Or the gui proposes to make choices (if possible) among different patterns which overlap and then does the reduction for al these at once. The chosen patterns should not overlap. The program does only one reduction step, not all (possible) reduction steps.

There should be the possibility to record a sequence of reductions, to make a kind of a movie with those.

10) Macros are special graphs, like the zipper. Practically you should be able to select a graph and save it as a macro, with a name. Likewise, you should be able to define and save macro moves, i.e. particular sequences of moves among particular graphs (or patterns).