Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
use match for intersect
Browse files Browse the repository at this point in the history
  • Loading branch information
RaphaelS1 committed Oct 15, 2021
1 parent 1d69eff commit fac186f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Authors@R:
email = "[email protected]"))
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
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ export(testSetList)
export(testSubset)
export(testTuple)
export(useUnicode)
import(ooplah)
importFrom(R6,R6Class)
importFrom(Rcpp,sourceCpp)
useDynLib(set6, .registration = TRUE)
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# set6 0.2.4

* Patch for R devel
* Imported ooplah

# set6 0.2.3

Expand Down
7 changes: 3 additions & 4 deletions R/operation_setintersect.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,9 @@
setintersect <- function(x, y) {
if (testCountablyFinite(x) & testCountablyFinite(y) & !inherits(x, "SetWrapper") &
!inherits(y, "SetWrapper")) {
return(Set$new(elements = intersect(
vapply(x$elements, as.character, character(1)),
vapply(y$elements, as.character, character(1))
)))
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") {
Expand Down

0 comments on commit fac186f

Please sign in to comment.