Elm Exactly

Basis entryBasics.append

A value of Basics. Its type is in Section C.3 Basics.

Static basis

op stands for ↦ OTSTAT(op)++ append ↦ (∀appendable. appendable→appendable   (∀appendable. →appendable,v)\begin{array}{|clcl|}\hline \opv {\ }& \text{stands for} {\ }& \mapsto {\ }& \OTstat(\opv)\\\hline \kw{++} {\ }& \href{/standard/basis/Basics/append}{\kw{append}} {\ }& \mapsto {\ }& (\forall\mv{appendable}.\,\mv{appendable} \rightarrow \mv{appendable}\\ {\ }& {\ }& {\ }& \phantom{(\forall\mv{appendable}.\,}{} \rightarrow \mv{appendable}, \isv)\\\hline\end{array}
Figure 40: The Static Operator Table, OTSTAT\OTstat

Dynamic basis

opstands for ↦ OTDYN(op)arity++append ↦ basic value2\begin{array}{|clclc|}\hline \opv {\quad}& \text{stands for} {\ }& \mapsto {\ }& \OTdyn(\opv) {\qquad}& \arity\\\hline \kw{++} {\quad}& \href{/standard/basis/Basics/append}{\kw{append}} {\ }& \mapsto {\ }& \text{basic value} {\qquad}& 2\\\hline\end{array}
Figure 46: The Dynamic Operator Table, OTDYN\OTdyn

Its APPLY

APPLY(append,s,s′) = {s s′}\begin{array}{rcl} \APPLY(\kw{append},s,s') {\ }& = {\ }& \{s\,s'\}\end{array}
APPLY(append,[],v) = {v}\begin{array}{rcl} \APPLY(\kw{append},\kw{[]},v) {\ }& = {\ }& \{v\}\end{array}
APPLY(append,v1::v2,v) = {v1::v′}\begin{array}{rcl} \APPLY(\kw{append},v_1\mathbin{\kw{::}}v_2,v) {\ }& = {\ }& \{v_1\mathbin{\kw{::}}v'\} \end{array}
Read it in its chapter·Permanent address: /standard/basis/Basics/append

Tests (7)

  • elm / AppendTypeSplitTest
    `++` gives the right result on `String`s and `List`s, including empty operands, long strings, nested appends, and a function whose type is `appendable`.
  • elm / InfixAssocRightConsAppendTest
    `::` and `++` (both precedence 5) associate to the right, so `"a" ++ "b" :: [ "c" ]` does not type.
  • elm / InfixPrecAppendOverEqTest
    `++` (precedence 5) binds more tightly than `==` (precedence 4).
  • elm-core / ListAppendTest
    The `++` operator joins two lists in order, and appending `[]` on the right leaves a list unchanged.
  • elm-core / ListConcatTest
    `++` joins lists in order, alone and in a chain of three, and appending to the empty list `[]` gives the other list.
  • elm-core / StringConcatContentTest
    A chain of twenty `++` operations and 100 nested `++` operations built by recursion both produce the right text.
  • elm-core / StringConcatTest
    `++` joins strings.

Discussions

Discuss this basis entry·Search the discussions on GitHub

Discussions are on GitHub; one about this basis entry has [b:Basics.append] 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.