3

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?

  • What does defstruct do? – Michael E2 Mar 21 '17 at 16:54
  • 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 – user2920796 Mar 21 '17 at 17:14
  • 1
    The macro function defineAccessors from (13722) is like a lightweight version of defstruct. – WReach Mar 21 '17 at 19:43
  • 1
    @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.) – Alan Mar 22 '17 at 02:41

0 Answers0