rational_group_generics: Ratinoal Group Generics

rational_group_genericsR Documentation

Ratinoal Group Generics

Description

Group generics allow you to implement methods for many generics at once. You cannot call a group generic directly; instead it is called automatically by members of the group if a more specific method is not found. For example, if you define a method for the 'S7_Math' group generic, it will be called when you call 'abs()', 'sign()', 'sqrt()', and many other similar generics (see below for a complete list).

Usage

S7_Math(x, ..., .Generic)

S7_Ops(e1, e2, ..., .Generic)

S7_Compare(e1, e2, ..., .Generic)

S7_Add(e1, e2, ..., .Generic)

find_base_generic(.Generic)

Arguments

x, e1, e2

Objects used for dispatch.

...

Additional arguments passed to methods.

.Generic

The name of the generic being dispatched on, i.e. if you've defined a method for 'S7_Math' and the user calls 'abs()' then '.Generic' will be '"abs"'.

Use 'find_base_generic()' to find the base generic that corresponds to the generic name.

Details

# Methods

The group generics contain the following methods:

* 'Ops': 'r paste(group_generics_md("Compare"), group_generics_md("Arith"), group_generics_md("Logic")) ' * 'Math': 'r group_generics_md("Math")' * 'Summary': 'r group_generics_md("Summary")' * 'Complex': 'r group_generics_md("Complex")' * 'matrixOps': 'r group_generics_md("matrixOps")'

Source

https://github.com/RConsortium/S7/blob/group-generics/R/method-group.R


bertcarnell/rational documentation built on Aug. 1, 2024, 8:14 p.m.