3
$\begingroup$

I guess I am used to using data structures in most languages, the closest function for Mathematica would be similar to the defstruct macro in Lisp... is there such a thing?

$\endgroup$
4
  • $\begingroup$ What does defstruct do? $\endgroup$
    – Michael E2
    Commented Mar 21, 2017 at 16:54
  • $\begingroup$ It creates a set of function to access list elements, say you have a structure named aStruct with elements {arg1, arg2, arg3). defstruct defines functions that access these elements directly $\endgroup$ Commented Mar 21, 2017 at 17:14
  • 1
    $\begingroup$ The macro function defineAccessors from (13722) is like a lightweight version of defstruct. $\endgroup$
    – WReach
    Commented Mar 21, 2017 at 19:43
  • 1
    $\begingroup$ @guymadison For the need you describe, what is the gain over an Association, which effectively comes with accessors? (Type checking could be handled by a constructor, if that's the issue.) $\endgroup$
    – Alan
    Commented Mar 22, 2017 at 2:41

0

Browse other questions tagged or ask your own question.