Patterns in static

Apophenia

Designated initializers

Functions so marked in this documentation use standard C designated initializers and compound literals to allow you to omit, call by name, or change the order of inputs. The following examples are all equivalent.

The standard format:

apop_text_to_db("infile.txt", "intable", 0, 1, NULL);

Omitted arguments are left at their default vaules:

apop_text_to_db("infile.txt", "intable");

You can use the variable's name, if you forget its ordering:

apop_text_to_db("infile.txt", "intable", .has_col_name=1, .has_row_name=0);

If an un-named element follows a named element, then that value is given to the next variable in the standard ordering:

apop_text_to_db("infile.txt", "intable", .has_col_name=1, NULL);
  • There may be cases where you can not use this form (it relies on a macro, which may not be available). You can always call the underlying function directly, by adding _base to the name and giving all arguments:
apop_text_to_db_base("infile.txt", "intable", 0, 1, NULL);
  • If one of the optional elements is an RNG and you do not provide one, I use one from apop_rng_get_thread.