Skip to content

Prohibition on length-1 tuples can make laplace functions annoying to use #1518

@WardBrian

Description

@WardBrian

@avehtari ran into this today, where he wanted to define a covariance function that takes only a single argument.

The prohibition is purely syntactic, because (1.0) is already equivalent to 1.0 (e.g. a real).

Some options:

  • Allow length 1 tuples with a required trailing comma (this is what e.g. Python does): (1.0, )
  • Add a helper function that creates length one tuples (e.g. singleton_tuple(1.0))
  • Allow a non-tuple tuple type as the forwarded arguments, in which case it looks for functions of only 1 argument.

All of these have a bit of a "magic" feel that makes me uneasy. The first is the most general, but we specifically avoided allowing this in the original tuples PR

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions