From 52d00b3b15c607a42fe3c8a29ed7d9abe64a902f Mon Sep 17 00:00:00 2001 From: Troels Henriksen Date: Mon, 13 Nov 2017 17:01:53 +0100 Subject: [PATCH] More on records. --- main.tex | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/main.tex b/main.tex index f9c2a8b..d47f5b8 100644 --- a/main.tex +++ b/main.tex @@ -1380,6 +1380,15 @@ \section{Records} {re = re, im = -im} \end{lstlisting} +This convenience is also present in tuple expressions. If we elide the +definition of a field, the value will be taken from the variable in +scope with the same name: + +\begin{lstlisting} +let conj ({re, im}: complex): complex = + {re, im = -im} +\end{lstlisting} + \subsection{Tuples as a Special Case of Records} In Futhark, tuples are merely records with numeric labels starting