R Under development (unstable) (2025-02-12 r87715 ucrt) -- "Unsuffered Consequences" Copyright (C) 2025 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > library(flint) > flint:::.initBasic() > > ## Hack: > flintIdenticalRecursive <- + function (object, reference) { + stopifnot(any(typeof(object) == c("list", "expression"))) + if (typeof(object) != typeof(reference) || + length(object) != length(reference) || + !identical(names(object), names(reference))) + return(FALSE) + for (i in seq_along(object)) + if (!(if (is(object[[i]], "flint") && is(reference[[i]], "flint")) + flintIdentical + else identical)(object[[i]], reference[[i]])) + return(FALSE) + TRUE + } > > L <- list(c("NULL"), + c("raw"), + c("ulong"), + c("logical", "integer", "slong", "fmpz"), + c("fmpq"), + c("double", "mag", "arf"), + c("arb"), + c("complex", "acf", "acb"), + c("character"), + c("name", "pairlist", "list"), + c("expression")) > l <- unlist(L) > p <- rep(cumsum(lengths(L)), times = lengths(L)) > u <- lapply(l, as, object = 1L) > > for (i in seq_along(u)) { + class. <- l[[p[[i]]]] + identical. <- + switch(class., + "NULL" =, "raw" =, "character" = identical, + "list" =, "expression" = flintIdenticalRecursive, + flintIdentical) + a <- do.call(c.flint, u[seq_len(i)], quote = TRUE) + b <- + switch(class., + "character" =, "list" =, "expression" = unlist(lapply(u[seq_len(i)], as, class.), recursive = FALSE), + rep(u[[p[[i]]]], times = i - 1L)) + stopifnot(identical.(a, b)) + } > > proc.time() user system elapsed 0.51 0.09 0.54