From 04712ab469fdd1b54386b0620bb9a7afcdf8d5f5 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Wed, 22 Mar 2023 16:16:25 -0700 Subject: Using both r and result in the various examples Corrected two, but there are other instances where the operation is done using `r`, or `result` interchangeably. --- Gentle_introduction_Inpla.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gentle_introduction_Inpla.md b/Gentle_introduction_Inpla.md index a1769dc..84bc2c2 100644 --- a/Gentle_introduction_Inpla.md +++ b/Gentle_introduction_Inpla.md @@ -176,7 +176,7 @@ Good! We get `S(S(S(Z)))` as the result of incrementation of `S(S(Z))` . To show the result as a natural number, use `prnat` command: ``` ->>> prnat result; +>>> prnat r; 3 >>> ``` @@ -213,7 +213,7 @@ Let's clean the result in case it could be used anywhere: (3 interactions, 0.00 sec) >>> r; S(S(S(Z))) - >>> prnat result; + >>> prnat r; 3 >>> free r; >>> @@ -846,4 +846,4 @@ In this reduction strategy, only connections that have interface names (thus, li b ->[2,... >>> - ``` \ No newline at end of file + ``` -- cgit v1.2.3 From 216e67302e64720a4da3934bbf7844025d0c3a25 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Wed, 22 Mar 2023 20:07:00 -0700 Subject: Update Gentle_introduction_Inpla.md --- Gentle_introduction_Inpla.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gentle_introduction_Inpla.md b/Gentle_introduction_Inpla.md index 84bc2c2..8a06a39 100644 --- a/Gentle_introduction_Inpla.md +++ b/Gentle_introduction_Inpla.md @@ -157,7 +157,7 @@ inc(r) >< S(x) => r~S(S(x)); Let's check the rule proviso. In the first rule, the name `r` occurs twice, so it satisfies the proviso. The second rule is also OK because the `r` and `x` are distinct and occur twice in the rule. -For agents can work as constructors and de-constructors, it could be good to use strings start from a capital letter such as `Z`, `S` and `Tree`, and all small letters for de-constructors such as `inc`. +Since agents can work as both constructors and de-constructors, we should use capitalized strings such as `Z`, `S` and `Tree` for constructors, and lowercases for de-constructors such as `inc`. Let's take the result of the increment operation for `S(S(Z))`: -- cgit v1.2.3 From 0d242d39de1fe7df016109ef6ba4c06d6b6a669c Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Wed, 22 Mar 2023 20:12:27 -0700 Subject: Update Gentle_introduction_Inpla.md --- Gentle_introduction_Inpla.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gentle_introduction_Inpla.md b/Gentle_introduction_Inpla.md index 8a06a39..1ad95fd 100644 --- a/Gentle_introduction_Inpla.md +++ b/Gentle_introduction_Inpla.md @@ -210,7 +210,7 @@ Let's clean the result in case it could be used anywhere: >>> add(ret, x) >< Z => ret~x; >>> add(ret, x) >< S(y) => add(ret, S(x))~y; >>> add(r,S(Z))~S(S(Z)); - (3 interactions, 0.00 sec) + (2 interactions, 0.00 sec) >>> r; S(S(S(Z))) >>> prnat r; -- cgit v1.2.3 From bdae5b925969ec0fc3a360d35d4071fd00daeda9 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Wed, 22 Mar 2023 20:16:56 -0700 Subject: Update Gentle_introduction_Inpla.md --- Gentle_introduction_Inpla.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gentle_introduction_Inpla.md b/Gentle_introduction_Inpla.md index 1ad95fd..b2455f9 100644 --- a/Gentle_introduction_Inpla.md +++ b/Gentle_introduction_Inpla.md @@ -281,7 +281,7 @@ There are built-in rules for the same built-in agents that each element is match ``` >>> [y1, y2, y3]~[Z, S(Z), S(S(Z))]; - (1 interactions, 0.00 sec) + (4 interactions, 0.00 sec) >>> y1 y2 y3; Z S(Z) S(S(Z)) >>> free y1 y2 y3; -- cgit v1.2.3 From fe3a3653d5cc84b64a3ca50b3a535e13b7f99025 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Wed, 22 Mar 2023 20:19:07 -0700 Subject: Update Gentle_introduction_Inpla.md --- Gentle_introduction_Inpla.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gentle_introduction_Inpla.md b/Gentle_introduction_Inpla.md index b2455f9..0ecb794 100644 --- a/Gentle_introduction_Inpla.md +++ b/Gentle_introduction_Inpla.md @@ -348,7 +348,7 @@ We can write it with the abbreviation as well: ``` >>> Eraser ~ A(x1,x2); (1 interactions, 0.00 sec) - >>> x1 x2 + >>> x1 x2; Eraser Eraser >>> free x1 x2; >>> -- cgit v1.2.3 From 0a308f58c1863e989b70dfe2f2f4d8e8653cad06 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Wed, 22 Mar 2023 20:23:18 -0700 Subject: Update Gentle_introduction_Inpla.md --- Gentle_introduction_Inpla.md | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/Gentle_introduction_Inpla.md b/Gentle_introduction_Inpla.md index 0ecb794..c5b1e1a 100644 --- a/Gentle_introduction_Inpla.md +++ b/Gentle_introduction_Inpla.md @@ -360,8 +360,8 @@ We can write it with the abbreviation as well: ![Dup](pic/dup.png) ``` >>> Dup(a1,a2) ~ [Z, S(Z), S(S(Z))]; - (1 interactions, 0.00 sec) - >>> a1 a2 + (10 interactions, 0.00 sec) + >>> a1 a2; [Z,S(Z),S(S(Z))] [Z,S(Z),S(S(Z))] >>> free a1 a2; >>> @@ -475,7 +475,7 @@ In interaction rules, attributes are recognised by using variables with a modifi >>> dup(a1,a2) >< (int i):xs => a1~(i:xs1), a2~(i:xs2), dup(xs1,xs2)~xs; >>> dup(a1,a2) >< [] => a1~[], a2~[]; >>> dup(a,b) ~ [1,2,3]; // This is also written as: a,b << dup([1,2,3]) - (4 interactions, 0.00 sec) + (2 interactions, 0.00 sec) >>> a b; [1,2,3] [1,2,3] >>> free a b; @@ -484,15 +484,10 @@ In interaction rules, attributes are recognised by using variables with a modifi -**We should be careful for operations of two attributes on distinct agents**. For instance, we take the following rule of an `add` agent: +**We should be careful for operations of two attributes on distinct agents**. For instance, we take the following rule of an `add` agent, of course, it works as an addition operation on two attributes: ``` >>> add(result, int b) >< (int a) => result~(a+b); -``` - -Of course, it works as an addition operation on two attributes: - -``` >>> add(r, 3) ~ 5; (1 interactions, 0.00 sec) >>> r; -- cgit v1.2.3 From 0d06790170ac4bc9cad3b488dae5ae75802d60bf Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Wed, 22 Mar 2023 20:26:38 -0700 Subject: Update Gentle_introduction_Inpla.md --- Gentle_introduction_Inpla.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Gentle_introduction_Inpla.md b/Gentle_introduction_Inpla.md index c5b1e1a..3e4d21a 100644 --- a/Gentle_introduction_Inpla.md +++ b/Gentle_introduction_Inpla.md @@ -577,10 +577,10 @@ The sequence of `` must be finished with the otherwise - Example: Fibonacci number: ``` - fib(result) >< (int n) - | n == 0 => result~0 - | n == 1 => result~1 - | _ => fib(r1)~(n-1), fib(r2)~(n-2), Add(result, r2)~r1; + fib(r) >< (int n) + | n == 0 => r~0 + | n == 1 => r~1 + | _ => fib(r1)~(n-1), fib(r2)~(n-2), Add(r, r2)~r1; // * We cannot write result~(r1+r2) for Add(result, r2)~r1 // because r1, r2 may have not been connected to attributes in the anonymous agents, -- cgit v1.2.3