init commit again

This commit is contained in:
Peter
2023-11-01 09:29:33 +01:00
parent 448147e7da
commit d6c745207b
250 changed files with 15552 additions and 1 deletions

View File

@@ -0,0 +1,59 @@
### Interacting
#### Output
[
Entity standard-out
Funcon print
]
Entity
_ -- standard-out!(_:values*) -> _
/*
This entity represents the sequence of values output by a particular
transition, where the empty sequence `( )` represents the lack of output.
Composition of transitions concatenates their output sequences.
*/
Funcon
print(_:values*) : =>null-type
/*
`print(X*)` evaluates the arguments `X*` and emits the resulting sequence of
values on the standard-out channel. `print( )` has no effect.
*/
Rule
print(V*:values*) -- standard-out!(V*) -> null-value
#### Input
[
Entity standard-in
Funcon read
]
Entity
_ -- standard-in?(_:values*) -> _
/*
This entity represents the sequence of values input by a particular
transition, where the empty sequence `( )` represents that no values are
input. The value `null-value` represents the end of the input.
Composition of transitions concatenates their input sequences, except that
when the first sequence ends with `null-value`, the second seqeunce has to be
just `null-value`.
*/
Funcon
read : =>values
/*
`read` inputs a single value from the standard-in channel, and returns it.
If the end of the input has been reached, `read` fails.
*/
Rule
read -- standard-in?(V:~null-type) -> V
Rule
read -- standard-in?(null-value) -> fail

View File

@@ -0,0 +1,99 @@
---
layout: default
title: "Interacting"
parent: Normal
ancestor: Funcons-beta
---
[Funcons-beta] : [Interacting.cbs]
-----------------------------
### Interacting
#### Output
<div class="highlighter-rouge"><pre class="highlight"><code>[
<i class="keyword">Entity</i> <span class="name"><a href="#Name_standard-out">standard-out</a></span>
<i class="keyword">Funcon</i> <span class="name"><a href="#Name_print">print</a></span>
]</code></pre></div>
<div class="highlighter-rouge"><pre class="highlight"><code><i class="keyword">Entity</i>
_ -- <span class="ent-name"><span id="Name_standard-out">standard-out</span></span>!(_:<span class="name"><a href="../../../Values/Value-Types/index.html#Name_values">values</a></span><sup class="sup">*</sup>) -> _</code></pre></div>
This entity represents the sequence of values output by a particular
transition, where the empty sequence <code>( )</code> represents the lack of output.
Composition of transitions concatenates their output sequences.
<div class="highlighter-rouge"><pre class="highlight"><code><i class="keyword">Funcon</i>
<span class="name"><span id="Name_print">print</span></span>(_:<span class="name"><a href="../../../Values/Value-Types/index.html#Name_values">values</a></span><sup class="sup">*</sup>) : =><span class="name"><a href="../../../Values/Primitive/Null/index.html#Name_null-type">null-type</a></span></code></pre></div>
<code><span class="name"><a href="#Name_print">print</a></span>(<i class="var">X<sup class="sup">*</sup></i>)</code> evaluates the arguments <code><i class="var">X<sup class="sup">*</sup></i></code> and emits the resulting sequence of
values on the standard-out channel. <code><span class="name"><a href="#Name_print">print</a></span>( )</code> has no effect.
<div class="highlighter-rouge"><pre class="highlight"><code><i class="keyword">Rule</i>
<span class="name"><a href="#Name_print">print</a></span>(<span id="Variable137_V*"><i class="var">V<sup class="sup">*</sup></i></span>:<span class="name"><a href="../../../Values/Value-Types/index.html#Name_values">values</a></span><sup class="sup">*</sup>) -- <span class="ent-name"><a href="#Name_standard-out">standard-out</a></span>!(<a href="#Variable137_V*"><i class="var">V<sup class="sup">*</sup></i></a>) -> <span class="name"><a href="../../../Values/Primitive/Null/index.html#Name_null-value">null-value</a></span></code></pre></div>
#### Input
<div class="highlighter-rouge"><pre class="highlight"><code>[
<i class="keyword">Entity</i> <span class="name"><a href="#Name_standard-in">standard-in</a></span>
<i class="keyword">Funcon</i> <span class="name"><a href="#Name_read">read</a></span>
]</code></pre></div>
<div class="highlighter-rouge"><pre class="highlight"><code><i class="keyword">Entity</i>
_ -- <span class="ent-name"><span id="Name_standard-in">standard-in</span></span>?(_:<span class="name"><a href="../../../Values/Value-Types/index.html#Name_values">values</a></span><sup class="sup">*</sup>) -> _</code></pre></div>
This entity represents the sequence of values input by a particular
transition, where the empty sequence <code>( )</code> represents that no values are
input. The value <code><span class="name"><a href="../../../Values/Primitive/Null/index.html#Name_null-value">null-value</a></span></code> represents the end of the input.
Composition of transitions concatenates their input sequences, except that
when the first sequence ends with <code><span class="name"><a href="../../../Values/Primitive/Null/index.html#Name_null-value">null-value</a></span></code>, the second seqeunce has to be
just <code><span class="name"><a href="../../../Values/Primitive/Null/index.html#Name_null-value">null-value</a></span></code>.
<div class="highlighter-rouge"><pre class="highlight"><code><i class="keyword">Funcon</i>
<span class="name"><span id="Name_read">read</span></span> : =><span class="name"><a href="../../../Values/Value-Types/index.html#Name_values">values</a></span></code></pre></div>
<code><span class="name"><a href="#Name_read">read</a></span></code> inputs a single value from the standard-in channel, and returns it.
If the end of the input has been reached, <code><span class="name"><a href="#Name_read">read</a></span></code> fails.
<div class="highlighter-rouge"><pre class="highlight"><code><i class="keyword">Rule</i>
<span class="name"><a href="#Name_read">read</a></span> -- <span class="ent-name"><a href="#Name_standard-in">standard-in</a></span>?(<span id="Variable309_V"><i class="var">V</i></span>:~<span class="name"><a href="../../../Values/Primitive/Null/index.html#Name_null-type">null-type</a></span>) -> <a href="#Variable309_V"><i class="var">V</i></a>
<i class="keyword">Rule</i>
<span class="name"><a href="#Name_read">read</a></span> -- <span class="ent-name"><a href="#Name_standard-in">standard-in</a></span>?(<span class="name"><a href="../../../Values/Primitive/Null/index.html#Name_null-value">null-value</a></span>) -> <span class="name"><a href="../../Abnormal/Failing/index.html#Name_fail">fail</a></span></code></pre></div>
____
From the [PLanCompS Project] | [CBS-beta issues...] | [Suggest an improvement...]
[Interacting.cbs]: Interacting.cbs
"CBS SOURCE FILE"
[Funcons-beta]: /CBS-beta/docs/Funcons-beta
"FUNCONS-BETA"
[Unstable-Funcons-beta]: /CBS-beta/docs/Unstable-Funcons-beta
"UNSTABLE-FUNCONS-BETA"
[Languages-beta]: /CBS-beta/docs/Languages-beta
"LANGUAGES-BETA"
[Unstable-Languages-beta]: /CBS-beta/docs/Unstable-Languages-beta
"UNSTABLE-LANGUAGES-BETA"
[CBS-beta]: /CBS-beta "CBS-BETA"
[PLanCompS Project]: https://plancomps.github.io
"PROGRAMMING LANGUAGE COMPONENTS AND SPECIFICATIONS PROJECT HOME PAGE"
[CBS-beta issues...]: https://github.com/plancomps/CBS-beta/issues
"CBS-BETA ISSUE REPORTS ON GITHUB"
[Suggest an improvement...]: mailto:plancomps@gmail.com?Subject=CBS-beta%20-%20comment&Body=Re%3A%20CBS-beta%20specification%20at%20Computations/Normal/Interacting/Interacting.cbs%0A%0AComment/Query/Issue/Suggestion%3A%0A%0A%0ASignature%3A%0A
"GENERATE AN EMAIL TEMPLATE"

View File

@@ -0,0 +1,12 @@
general {
funcon-term:
sequential(
print( ),
print( list-elements list-nil ))
;
}
tests {
result-term: null-value;
standard-out: [ ];
}

View File

@@ -0,0 +1,14 @@
general {
funcon-term:
sequential(
print 1,
print(2,3),
print true,
print(sequential(print tuple null-value, "OK")))
;
}
tests {
result-term: null-value;
standard-out: [ 1, 2, 3, true, tuple(null-value), "OK" ];
}

View File

@@ -0,0 +1,12 @@
general {
funcon-term: print(reverse(read, read, read));
}
inputs {
standard-in: (1,2,3);
}
tests {
result-term: null-value;
standard-out: [3,2,1];
}

View File

@@ -0,0 +1,12 @@
general {
funcon-term: print(read, else(read, "OK"));
}
inputs {
standard-in: 1;
}
tests {
result-term: null-value;
standard-out: [1, "OK"];
}

View File

@@ -0,0 +1,12 @@
general {
funcon-term: print(read, read, else(read, "OK"));
}
inputs {
standard-in: (1,2);
}
tests {
result-term: null-value;
standard-out: [1, 2, "OK"];
}