I am trying to return each element from a set containing Brewage objects by running it through a for all loop. But the return value gets messed up when i try to do so.
The loop function:
public pure Scan: set of Brewage ==> Brewage
Scan(brewage) ==
for all q in set brewage do
return q
Brewage Constructor:
public StringType = seq of char;
public StringLabel = seq of char;
public Char = char;
instance variables
type : StringType;
label : StringLabel;
deposit : Char;
operations
public Brewage: StringType * StringLabel * Char ==> Brewage
Brewage(ty, la, de) ==
( type := ty;
label := la;
deposit := de
);
The error i get is in the Scan function and is the following:
Operation returns void value. Actual: (() | Brewage) Expected: Brewage
You can use a let binding to select a Brewage in the set and then return it: