Modules and connections

From Impure Wiki

Jump to: navigation, search

Impure is a visual programming language - which means that you do not type code to make programs, but instead arrange elements in space and make connections between then to set up an information flow.


Contents

Modules

Everything in Impure is done by modules. Different kinds of modules are able to load, generate, analyze, convert, filter and visualize data. Other ones are controls that let users interact with the process. Many modules perform several of these operations at once.

Let's take a closer look at the components of a module:

Module elements.png

Inlets and outlets

All modules have one or more inlets: these are the ports through which they get data from the outside world to do something with it. Some inlets are required, meaning the module will do nothing and sit idle until you connect these ports to some source. Others are optional, and give you further control over the operation(s) the module performs, but they have default values that will be used if you don't set one yourself.

Many modules (but not all of them) do also have an outlet, which make the result of the module's process available, so you can use it to feed another modules and thus set up your processing chain. One outlet can feed as many inlets as you wish, enabling you to process or visualize the same data in many different ways.

Both inlets and outlets offer a convenient contextual help that will show up when you hover your mouse over them. There, you will find the corresponding data structure (in red), a short description (in black), and a string representation of the data that is coming in or out of that port, if any.

Inlet tooltip.png

If you are used to a text-based programming environment, you can think of the inlets as the arguments of a function or method, and of the outlet as its return value.

Direct input

Some types of data structures give you the possibility of typing the values you wish directly into the inlet itself, saving you the need to place other modules on the stage for that purpose. These inlets are identified by a small arrow in the bottom right of the icon. There is also a gray rectangle to the left of the inlet: just click on it and start typing the input value.

Direct input.png

After you click in any other part of the space, or do nothing for a few seconds, your input will automatically be converted into a Data Structure module of the appropriate type.

Input box 2.png


Connections

Modules can be very powerful, but they will do nothing by themselves. Impure comes to life only when you link them together to define an information flow, that begins with some data source and typically ends with one or more visualizations or processed outputs.

Defining connections is easy. You just need to hover on an outlet, click on the purple circle that appears, drag the connecting line to your destination module, and release it in the appropriate inlet.

Connection dragging.png

After the connection is established, it will be visible as a line with an arrow tip at the middle that shows the flow direction. If data is flowing through that channel, the line will be red. Otherwise (if the source has a void or null value) it will be yellow.

Connection done.png

Personal tools