Skip to content

Commit a53158c

Browse files
committed
Move integerish helper to utils
1 parent ca76e70 commit a53158c

3 files changed

Lines changed: 2 additions & 4 deletions

File tree

AGENTS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ EOF
3636
- When adding tests, prefer user-facing API tests (e.g. `expect_quick_identical()`); avoid asserting on generated Fortran/C translation strings.
3737

3838
- While troubleshooting and iterating towards a solution, you can run targeted single-file tests; before committing/pushing, always run the full test suite and `rcmdcheck`.
39+
- Before finishing a task, always run the full test suite and `rcmdcheck`.
3940

4041
- Prefer extending S7 classes with explicit properties over attaching arbitrary unchecked attributes.
4142

R/aaa-utils.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ is_scalar_integer <- function(x) is.integer(x) && !is.object(x) && length(x) =
149149
is_string <- function(x) is.character(x) && length(x) == 1L && !is.na(x) # could also be 'glue' class.
150150
is_bool <- function(x) is.logical(x) && !is.object(x) && length(x) == 1L && !is.na(x)
151151
is_number <- function(x) is.numeric(x) && !is.object(x) && length(x) == 1L && !is.na(x)
152+
is_scalar_integerish <- function(x) is_number(x) && trunc(x) == x
152153
is_wholenumber <- function(x) is.numeric(x) && !is.object(x) && length(x) == 1L && !is.na(x) &&
153154
x >= 0L && (is.integer(x) || is.double(x) && trunc(x) == x)
154155
}

R/r2f-closures.R

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -705,10 +705,6 @@ compile_sapply_assignment <- function(
705705
to <- ee$to
706706
by <- ee$by
707707

708-
is_scalar_integerish <- function(x) {
709-
is_number(x) && !is.na(x) && trunc(x) == x
710-
}
711-
712708
if (!is.null(from) && !is.null(to) && identical(from, to)) {
713709
return(1L)
714710
}

0 commit comments

Comments
 (0)