Infix: S3 helper classes

Description Usage Arguments Details See Also

Description

There is no formal class definition for S3. Simply add 'Infix' or 'Print' to the class attribute and it inherits the methods. It is the same as Binary-class or Show-class just for S3. This is inteded to be used with retList.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
## S3 method for class 'Print'
print(x, ...)

## S3 method for class 'Infix'
e1 + e2

## S3 method for class 'Infix'
e1 - e2

## S3 method for class 'Infix'
e1 / e2

## S3 method for class 'Infix'
e1 %% e2

## S3 method for class 'Infix'
e1 ^ e2

## S3 method for class 'Infix'
e1 < e2

## S3 method for class 'Infix'
e1 > e2

## S3 method for class 'Infix'
e1 == e2

## S3 method for class 'Infix'
e1 >= e2

## S3 method for class 'Infix'
e1 <= e2

## S3 method for class 'Infix'
e1 & e2

## S3 method for class 'Infix'
!x

## S3 method for class 'Infix'
as.environment(x)

Arguments

x

an object

...

arguments passed to the local print method.

e1

lhs operand

e2

rhs operand

Details

The lhs is coerced with as.environment and in that environment the binary operators must be found and named as .<binaryOperator> (see the example for retList). This is implemented for the following operators: +, -, *, /, %%, ^, <, >, ==, >=, <=, &. Also part of the operators you can implement with Infix is !, although it is unary.

See Also

Binary-class, retList


wahani/aoos documentation built on May 27, 2017, 11:54 p.m.