Note that the concept of \emph{state} is no more than having some way
to communicate a value from one cycle to the next. By introducing a
- \hs{delay} function, we can do exactly that: Delay (each value in) a
+ \hs{delay} function, we can do exactly that: delay (each value in) a
stream so that we can "look into" the past. This \hs{delay} function
simply outputs a stream where each value is the same as the input
value, but shifted one cycle. This causes a \quote{gap} at the
beginning of the stream: What is the value of the delay output in the
- first cycle? For this, the \hs{delay} function has a second input
- (which is a value, not a stream!).
+ first cycle? For this, the \hs{delay} function has a second input, of
+ which only a single value is used.
\in{Example}[ex:DelayAcc] shows a simple accumulator expressed in this
style.
\item tail has the type \hs{(n > 0) => Vector n -> Vector (n - 1)}
\item This means that xs must have the type \hs{(n > 0) => Vector n}
\item This means that sum must have the type \hs{(n > 0) => Vector n -> a}
+ (The type \hs{a} is can be anything at this stage, we will not try to finds
+ its actual type in this example).
\item sum is called with the result of tail as an argument, which has the
type \hs{Vector n} (since \hs{(n > 0) => Vector (n - 1)} is the same as \hs{(n >= 0)
=> Vector n}, which is the same as just \hs{Vector n}).