Elm Exactly

Rule 151e-enc-array

EncodingEncτ(v)=j\Enc{\tau}(v)=j
⊢Array.toList v⇒v′Encτ List(v′)=jEncτ Array(v)=j\frac{\begin{array}{c}\japp{\kw{Array.toList}}{v}{v'}\premsep\Enc{\tau\,\tList}(v')=j\end{array}}{\begin{array}{c}\Enc{\tau\,\tArray}(v)=j\end{array}}
(151)
Read it in its chapter·Permanent address: /standard/rules/e-enc-array

Comments

An array is encoded as the list of its elements. Array.toList is the basic value of Section D.4.9, bound to no identifier of the basis.

TeX source
\defnrule[r:e-enc-array]
  {\japp{\kw{Array.toList}}{v}{v'}\premsep\Enc{\tau\,\tList}(v')=j}
  {\Enc{\tau\,\tArray}(v)=j}

Tests (3)

  • elm / MinimalPipeArrayTest
    A pipe at `Array Int`: the value the driver sends in comes back out.
  • elm / PortEchoArrayStringFlagsTest
    An `Array String` sent out through a port comes back unchanged through an incoming port, for each of two sample values received as flags.
  • elm / PortPipeListArrayTest
    JSON arrays received at `List` and `Array` types go out as the same arrays.

Discussions

Discuss this rule·Search the discussions on GitHub

Discussions are on GitHub; one about this rule has [r:e-enc-array] in its title.

A Standard Definition of Elm? (Draft version 0.4) © Rupert Smith. The text is licensed under CC BY 4.0: share and adapt it freely, with credit and a link to the licence.