diff --git a/DESCRIPTION b/DESCRIPTION index 75758fc5..ebb657ac 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: set6 Title: R6 Mathematical Sets Interface -Version: 0.2.3 +Version: 0.2.4 Authors@R: c(person(given = "Raphael", family = "Sonabend", @@ -13,7 +13,7 @@ Authors@R: email = "f.kiraly@ucl.ac.uk")) Description: An object-oriented package for mathematical sets, upgrading the current gold-standard {sets}. Many forms of mathematical sets are implemented, including (countably finite) sets, tuples, intervals (countably infinite or uncountable), and fuzzy variants. Wrappers extend functionality by allowing symbolic representations of complex operations on sets, including unions, (cartesian) products, exponentiation, and differences (asymmetric and symmetric). LinkingTo: Rcpp -Imports: checkmate, Rcpp, R6, utils +Imports: checkmate, ooplah, Rcpp, R6, utils Suggests: knitr, testthat, devtools, rmarkdown License: MIT + file LICENSE LazyData: true diff --git a/NAMESPACE b/NAMESPACE index bc1b1f94..89cf8dfe 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -193,6 +193,7 @@ export(testSetList) export(testSubset) export(testTuple) export(useUnicode) +import(ooplah) importFrom(R6,R6Class) importFrom(Rcpp,sourceCpp) useDynLib(set6, .registration = TRUE) diff --git a/NEWS.md b/NEWS.md index 20e7383e..900085ed 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,8 @@ +# set6 0.2.4 + +* Patch for R devel +* Imported ooplah + # set6 0.2.3 * Containedness checks for 'n' dimensional sets no longer require same length vectors if power is diff --git a/R/operation_setintersect.R b/R/operation_setintersect.R index 20acb88b..a14d2d84 100644 --- a/R/operation_setintersect.R +++ b/R/operation_setintersect.R @@ -53,7 +53,9 @@ setintersect <- function(x, y) { if (testCountablyFinite(x) & testCountablyFinite(y) & !inherits(x, "SetWrapper") & !inherits(y, "SetWrapper")) { - return(Set$new(elements = intersect(x$elements, y$elements))) + elx <- vcapply(x$elements, as.character) + eli <- x$elements[match(vcapply(y$elements, as.character), elx, 0L)] + return(Set$new(elements = eli)) } if (getR6Class(y) == "Universal") { diff --git a/R/zzz.R b/R/zzz.R index b844bd65..4f41daa0 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -1,4 +1,6 @@ +#' @import ooplah #' @importFrom R6 R6Class +NULL # nocov start .onLoad <- function(libname, pkgname) { diff --git a/man/set6-package.Rd b/man/set6-package.Rd index ad3b145f..1b8207a0 100644 --- a/man/set6-package.Rd +++ b/man/set6-package.Rd @@ -40,7 +40,7 @@ Useful links: } \author{ -\strong{Maintainer}: Raphael Sonabend \email{raphael.sonabend.15@ucl.ac.uk} (\href{https://orcid.org/0000-0001-9225-4654}{ORCID}) +\strong{Maintainer}: Raphael Sonabend \email{raphaelsonabend@gmail.com} (\href{https://orcid.org/0000-0001-9225-4654}{ORCID}) Authors: \itemize{ diff --git a/src/RcppExports.cpp b/src/RcppExports.cpp index 447dcb86..2ede4b13 100644 --- a/src/RcppExports.cpp +++ b/src/RcppExports.cpp @@ -5,6 +5,11 @@ using namespace Rcpp; +#ifdef RCPP_USE_GLOBAL_ROSTREAM +Rcpp::Rostream& Rcpp::Rcout = Rcpp::Rcpp_cout_get(); +Rcpp::Rostream& Rcpp::Rcerr = Rcpp::Rcpp_cerr_get(); +#endif + // IntervalContains std::vector IntervalContains(NumericVector x, long double inf, long double sup, long double min, long double max, bool bound, const char* class_str); RcppExport SEXP _set6_IntervalContains(SEXP xSEXP, SEXP infSEXP, SEXP supSEXP, SEXP minSEXP, SEXP maxSEXP, SEXP boundSEXP, SEXP class_strSEXP) { diff --git a/tests/testthat/test_operations_setintersect.R b/tests/testthat/test_operations_setintersect.R index 1d49aafa..d3c7eda3 100644 --- a/tests/testthat/test_operations_setintersect.R +++ b/tests/testthat/test_operations_setintersect.R @@ -72,14 +72,17 @@ test_that("ComplementSet", { }) test_that("ProductSet", { - expect_equal( - setproduct(Set$new(1, 2), Set$new(3, 4), simplify = TRUE) & Set$new(Tuple$new(1, 4)), - Set$new(Tuple$new(1, 4)) - ) - expect_equal( - (Set$new(1, 2) * Set$new(3, 4)) & Set$new(Tuple$new(1, 4), Tuple$new(5, 6)), + useUnicode(FALSE) + obj <- setproduct(Set$new(1, 2), Set$new(3, 4), simplify = TRUE) & Set$new(Tuple$new(1, 4)) - ) - expect_equal((Set$new(1, 2) * Set$new(3, 4)) & Tuple$new(1, 4), Set$new()) - expect_message((Set$new(1, 2) * Set$new(3, 4)) & (Set$new(1, 2) * Set$new(3, 4)), "currently not implemented") + expect_equal(as.character(obj), "{(1, 4)}") + obj <- (Set$new(1, 2) * Set$new(3, 4)) & + Set$new(Tuple$new(1, 4), Tuple$new(5, 6)) + expect_equal(as.character(obj), "{(1, 4)}") + expect_equal(as.character((Set$new(1, 2) * Set$new(3, 4)) & Tuple$new(1, 4)), + "{}") + expect_message( + (Set$new(1, 2) * Set$new(3, 4)) & (Set$new(1, 2) * Set$new(3, 4)), + "currently not implemented") + useUnicode(TRUE) })