Coronavirus (Covid-19): Latest updates and information
Skip to main content Skip to navigation

Extra EDEN resources

A number of additional resources relating to the EDEN interpreter are linked to this webpage.

Additional features of EDEN

There are a number of significant features of EDEN that have not been covered in depth in the lectures and labs. Most of these are more fully documented in the EDEN handbook and are illustrated in models within the EM projects archive (which can also be accessed via the ~empublic/projects/ directory and searched - for instance, by using basic Unix commands such as grep TARGETSTRING */* ). They include:

The execute() command: by providing a valid EDEN input string as an argument to this command, you can execute a piece of EDEN code that has been synthesised using the interpreter itself. Note that you can use other notations inside such strings (e.g. "%scout\nscreen=<win1 / win2>;\n") as well as substrings whose values depend on the current values of other observables. The "//" operator is used in EDEN to concatenate strings, and the str() operator is used to convert values, and scalars in particular, into strings (e.g. "%eden\na" // str(i) // " is b" // str(i) // "+1);\n"). The execute() command is frequently used to generate scripts that involve the repetition of a similar syntactic pattern with minor variations.

Pointers in EDEN: Associated with the observable "x" there is a pointer to this observable denoted by "&x". The expression "*&x" returns the value of x. The use of such pointers is illustrated in the vimodesBeynon2006 model.

The forget() command: If you interrogate an observable that has not yet been defined in EDEN, the value @, meaning undefined is returned. Provided that there is no other observable whose value depends on the observable x, you can use forget(&x) to 'forget' the observable x - restoring the status that it had before it was first introduced. There is a counterpart for forget() in EDEN in Donald: the "delete X" command can be used to remove the Donald observable X where there are no observables dependent on X.

The backticks operator: It is sometimes useful to be able to convert a string into an observable name. This conversion can be done by placing the string between backticks. For instance, if the observable x has the value 0, then `"a" // str(x)` is interpreted by EDEN as the identifier a0, and can be used in place of a0 in definitions.

The EDEN symboltable() and symboldetail() functions: Provided that a model is not too large, you can find out the current content of the EDEN symboltable at any time by invoking the command symboltable(). No arguments are required for this function, which is intended purely for interactive use and cannot be used on the RHS of a dependency relation. If you want to access the information associated with a specific EDEN observable, say x, you can find this by invoking symboldetail(&x). This function returns a list which records information such as the name of the observable, its current definition as a string, the observables that are defined in terms of it, those observables on which it itself directly depends, and the last EDEN agent or action that changed its value.

The eager() command and the procmacro construct: There is a certain tension in the hybrid EDEN environment as to whether a procedure should be interpreted as changing state in an invisible way (like a procedure in a traditional program) or whether it should correspond to a sequence of actions that change the state in a way that can be observed by the user (as happens e.g. when we want to automate the opening of a door by incrementally changing the degree to which it is open). To achieve the latter effect, it is sometimes possible to introduce eager() commands in the body of the procedure to indicate that the side-effects of an action are to be performed at once rather than processed only after the procedure has been executed. Typically, an eager() command is appropriate after a redefinition that is meaningful to the human interpreter has been made: where a sequence of such redefinitions is to automated, the procmacro (rather than proc) construct can sometimes be used.

Timers can be created in EDEN by means of the edenclocks feature, which is documented in the Quick Guide to Eden that you can access from the Help tab on the EDEN Input Window.

File IO: Data and definitions can be written to external files by the EDEN interpreter using file manipulation somewhat resembling those used in the C language - for a simple illustration of their use consult the project conveyancingForster2002. Note that projects of this nature, which write to the file system, can only be run in directories where you have write permission.

Additional Scout displays By default, Scout supports a single display which is called 'screen' (a reserved identifier in EDEN). It is sometimes useful to be able to introduce additional displays - the use of this feature is illustrated (e.g.) in the sudokuaceBeynon2008 model within the EM Project Archive, where - in addition to the usual Scout 'screen' display there is another display entitled 'buttoDisplay'. The key commands needed to set up this additional display are as follows:

%eden
OpenDisplay("buttonDisplay",214,46);
proc buttonDisplay_display_screen : buttonDisplay { DisplayScreen(&buttonDisplay, "buttonDisplay"); }

%scout

window poss_digits = {

...
};
buttonDisplay = <poss_digits / ... >;


The %angel notation The %angel notation is an alternative to Scout where managing window layout and interface specification is concerned. Its use is illustrated in the construction of the EMPE, in Chris Pether's Cricket Scoring construal and in Matthew Carter's keyboard dynamics model: /dcs/emp/empublic/teaching/ExampleModels/keyboarddynamicsCarter2011. Basic documentation can be found here.

Virtual Agency: In standalone versions of EDEN (but not the variant that executes in the Cadence environment!) there is a form of "virtual agency", whereby it is possible to introduce a new context in the EDEN Input Window in which all observable names get to be prepended by a particular string. Specifically, you can type >> into the EDEN Input Window in order to change the context so that a definition of the form "a is b+c;" within this context is interpreted as "X_a is X_b + X_c;". To escape from such a context, you simply type >>. You are not advised to use this feature, but may encounter it in some models. (It has a particularly significant role in distributed EDEN models - as documented in connection with the dtkeden interpreter.) Changing context in the EDEN Input Window is a hazardous process, and you are advised to avoid using it unless it is absolutely essential.

Other useful tutorial materials

There are three tools that can be usefully deployed in building and documenting models. They are the Dependency Modelling Tool (DMT), the EDDI definitive notation for relational databases, and the Agent-Oriented Parser (AOP). Here are links to labs from previous CS405 variants relating to each of these three tools:

Credit will be given for incorporating use of these tools in your modelling exercises where this is appropriate. Note that EDDI underwent a reimplementation between tkeden-1.66 and tkeden-1.67 as a result of which a view defined by a relational algebra expression in EDDI obtained a far more direct and intelligible internal representation in EDEN. Unfortunately some of the functionality was also lost at this point, so that for instance processing of real as opposed to integer values in queries that select tuples no longer works. We shall try as far as possible to remedy problems of this nature: please report them via the CS405 forum.