<aside> 💡 - Compound data represents information where more than 2 values belong together, such as with coordinates and biodata.

</aside>


What’s compound data and why do we need it?

<aside> 💡 I like to think of it this way (though I’ve yet to verify how valid this proposition is) — any related data which can be presented within a spreadsheet can also be compressed within a singular compound object/structure.

e.g. Employee biodata; in code, we can create employee objects/structures with multiple attributes like name, age, position, salary, address. Such biodata can be presented very simply within a spreadsheet or database.

</aside>

<aside> 🧠 What’s the difference between structures and objects?

As according to the user Donnie in this Stack Overflow discussion,

Generally speaking, objects bring the full object oriented functionality (methods, data, virtual functions, inheritance, etc, etc) whereas structs are just organized memory. Structs may or may not have support for methods / functions, but they generally won't support inheritance and other full OOP features.

Note that I said generally speaking ... individual languages are free to overload terminology however they want to.

</aside>


Constructing compound data

define-struct