Cuneiform (programming language): Difference between revisions

Content deleted Content added
m Lists and list processing: syntaxhighlight
m Type System: syntaxhighlight
Line 174:
Cuneiform provides [[Record_(computer_science)|record]]s (structs) as compound data types. The example below shows the definition of a variable <code>r</code> being a record with two fields <code>a1</code> and <code>a2</code>, the first being a string and the second being a Boolean.
 
<syntaxhighlight lang="swift">
<pre>
let r : <a1 : Str, a2 : Bool> =
<a1 = "my string", a2 = true>;
</syntaxhighlight>
</pre>
 
Records can be accessed either via projection or via pattern matching. The example below extracts the two fields <code>a1</code> and <code>a2</code> from the record <code>r</code>.
 
<syntaxhighlight lang="swift">
<pre>
let a1 : Str = ( r|a1 );
 
let <a2 = a2 : Bool> = r;
</syntaxhighlight>
</pre>
 
===Lists and list processing===