Understanding splat operator in return statement

  1. coefnames(probit_boot) returns a Vector of Strings corresponding to "lnnlinc", "age", etc.
  2. Symbol.(coefnames(probit_boot)) casts these strings as Symbols, which is necessary because it uses the (; ags...) constructor for a NamedTuple.
  3. In Julia, a NamedTuple is kind of like a dictionary, in that it can be used to look up objects based on a Symbol. The syntax (; :a => 1, :b => 2) can be used to create the named tuple (a = 1, b = 2). Using => instead of = means you can construct named tuples programmatically, i.e. not writing out the literal a but rather using something like a_sym = :a; (; a_sym => 1).
1 Like