Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Mata Programming - passing a function as an argument

    There are many different techniques and names for passing something to a function which will be called back with that function. Examples include using an object which implement an interface/protocol, to functions as objects, to passing function pointers/delegates. Is there any way to achieve something like this in Mata function. It will significantly reduce code duplication in a project I am working on. Thank you

  • #2
    You can pass function to functions with pointers, see M-2 ftof in the Mata manual. Mata has classes for object-oriented programming, so I would also take a look at the class entry in the manual to see if you can implement some of the concepts you mention.

    Comment


    • #3
      Thank you very much - http://www.stata.com/manuals13/m-2ftof.pdf - was exactly what I was after.

      Comment

      Working...
      X