Compound data type: Difference between revisions
Content added Content deleted
Line 376: | Line 376: | ||
<pre>[x:10 y:20]</pre> |
<pre>[x:10 y:20]</pre> |
||
=={{header|ATS}}== |
|||
There are numerous ways to do this. The simplest is to use an unallocated tuple type: |
|||
<lang ATS>typedef point (t : t@ype+) = @(t, t) |
|||
val p : point double = (1.0, 3.0)</lang> |
|||
If one insists both that the type be unique (as opposed to an alias for a tuple) and that the notation to create a point be '''Point (x, y)''', then the following works: |
|||
<lang ATS>datatype point (t : t@ype+) = |
|||
| Point of (t, t) |
|||
val p : point double = Point (1.0, 3.0)</lang> |
|||
=={{header|AutoHotkey}}== |
=={{header|AutoHotkey}}== |