Compound data type: Difference between revisions
Content added Content deleted
(Add Racket solution) |
|||
Line 1,204: | Line 1,204: | ||
# $d$f |
# $d$f |
||
# [1] TRUE</lang> |
# [1] TRUE</lang> |
||
=={{header|Racket}}== |
|||
The most common method uses structures (similar to records): |
|||
<lang lisp> |
|||
#lang racket |
|||
(struct point (x y)) |
|||
</lang> |
|||
Alternatively, you can define a class: |
|||
<lang lisp> |
|||
#lang racket |
|||
(define point% ; classes are suffixed with % by convention |
|||
(class object% |
|||
(super-new) |
|||
(init-field x y))) |
|||
</lang> |
|||
=={{header|REXX}}== |
=={{header|REXX}}== |