### 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
