From: Robin Hankin <r.hankin_at_noc.soton.ac.uk>

Date: Fri 15 Sep 2006 - 13:56:56 GMT

in: .findInheritedMethods(classes, fdef, mtable)

Date: Fri 15 Sep 2006 - 13:56:56 GMT

R version 2.4.0 alpha (2006-09-15 r39323), MacOSX 10.4.7

If either argument is a brob (but neither is a glub), use .ArithGlub

If neither is a brob or a glub, use standard "+"

brob#ANY ANY#glub

in: .findInheritedMethods(classes, fdef, mtable)

I don't understand what to do to avoid getting the warning message [and it's also using the wrong function: I want it to call .ArithGlub() here, not .ArithBrob() ]

I need to use signature(e1="brob", e2="anything except a glub") but I can't figure out how to do this.

setClass("brob",

representation = representation (x="numeric",positive="logical"),

prototype = list(x=numeric(),positive=logical()) ) setClass("glub", representation = representation(real="brob",imag="brob"), prototype = list(real=new("brob"), imag=new("brob")) )

.ArithBrob <- function(e1,e2){

stop(paste("binary operator \"", .Generic, "\" not defined for
Brobdingnagian numbers"))

}

.ArithGlub <- function(e1,e2){

stop(paste("binary operator \"", .Generic, "\" not defined for
Glub numbers"))

}

setMethod("Arith",signature(e1 = "brob", e2="brob"), .ArithBrob) setMethod("Arith",signature(e1 = "brob", e2="ANY" ), .ArithBrob) setMethod("Arith",signature(e1 = "ANY" , e2="brob"), .ArithBrob)

setMethod("Arith",signature(e1 = "glub"), .ArithGlub) setMethod("Arith",signature(e2 = "glub"), .ArithGlub)

-- Robin Hankin Uncertainty Analyst National Oceanography Centre, Southampton European Way, Southampton SO14 3ZH, UK tel 023-8059-7743 ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-develReceived on Sat Sep 16 00:05:27 2006

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.1.8, at Fri 15 Sep 2006 - 15:30:07 GMT.

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel.
Please read the posting
guide before posting to the list.
*