diff options
| author | Shinya Sato <shinnya.sato@gmail.com> | 2021-12-21 00:48:15 +0900 |
|---|---|---|
| committer | Shinya Sato <shinnya.sato@gmail.com> | 2021-12-21 00:48:15 +0900 |
| commit | ae9d25bcccdc220534b86e5092532541299f99f0 (patch) | |
| tree | 1fdefd5b5c5b375c0376ebee3a3079bccbf8d710 /README.md | |
| parent | f9d572c04178d5496123ce68e3f9a65c09629f24 (diff) | |
| download | inpla-ae9d25bcccdc220534b86e5092532541299f99f0.tar.gz inpla-ae9d25bcccdc220534b86e5092532541299f99f0.zip | |
Update README.md
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 32 |
1 files changed, 19 insertions, 13 deletions
@@ -280,6 +280,7 @@ Inpla is a multi-threaded parallel interpreter of interaction nets. Once you wri - [Example: Operations on unary natural numbers](#example-operations-on-unary-natural-numbers) * [Built-in Agents](#built-in-agents) * [Attributes (integers)](#attributes-integers) + - [Built-in anonymous agent for attributes](#built-in-anonymous-agent-for-attributes) - [Arithmetic expressions on attributes](#arithmetic-expressions-on-attributes) - [Interaction rules with expressions on attributes](#interaction-rules-with-expressions-on-attributes) - [Built-in rules of attributes in the anonymous agents](#built-in-rules-of-attributes-in-the-anonymous-agents) @@ -556,9 +557,9 @@ Append(r, listB) ~ listA --> r ~ (listA ++ listB) // pseudo code ## Attributes (integers) -Agents can have integers as their ports. These integers are called *attributes*. +Agents can be extended so that these can have integers as their ports. These integers are called *attributes*. -* For instance, `A(100)` is evaluated as an agent `A` that holds an attribute of an integer value 100. +* For instance, `A(100)` is evaluated as an agent `A` that holds an attribute of an integer value `100`. ``` >>> x~A(100); @@ -569,15 +570,20 @@ Agents can have integers as their ports. These integers are called *attributes*. >>> ``` -It is possible to use integers the same as agents, but these are recognised as attributes of an anonymous built-in agent in Inpla: -``` ->>> x~100; -(0 interactions, 0.00 sec) ->>> x; -100 ->>> free x; ->>> -``` + +### Built-in anonymous agent for attributes +It is possible to use integers the same as agents, but these are recognised as attributes of a built-in *anonymous agent* in Inpla. For instance, when we write just `x~100`, then the `100` is regarded as an attribute of the anonymous agent. + +* The following is another version of the above example in the case of using the anonymous agent: + + ``` + >>> x~100; // The `100' is regarded as an attribute of an anonymous agent + (0 interactions, 0.00 sec) + >>> x; + 100 + >>> free x; + >>> + ``` @@ -630,7 +636,7 @@ The symbol of addition, subtraction, multiplication, division and modulo are `+` ### Interaction rules with expressions on attributes -In interaction rules, attributes can be recognised by the modifier `int` in order to apply arithmetic expressions. **We can use the same variable with the modifier `int` many times (of course, zero times is also OK) in the connection parts of interaction rules**. +In interaction rules, attributes are recognised by a modifier `int` in order to apply arithmetic expressions. **We can use the same variable with the modifier `int` many times (of course, zero times is also OK) in the connection parts of interaction rules**. * Example: Incrementor on an attribute: ``` @@ -644,7 +650,7 @@ In interaction rules, attributes can be recognised by the modifier `int` in orde ``` -- Example: Duplicator of integer lists: +- Example: Duplicator of integer lists. We note that, in the rule of the first line in the below example, the twice occurrences of *i* in the right-hand side is allowed because the *i* is a variable for attributes:  |
