Skip to content

Allow recursive argument to be passed silently if not used by serializer #3

@orgadish

Description

@orgadish

I am using hashr::hash to write a version of purrr::map which only computes on the unique elements in the list, but I only want to recurse one layer down and I don't know what the values one layer down will be. So I currently have to do the following:

nonrecursive_hash <- function(x) {
    if(inherits(x, c("list", "character"))) hashr::hash(ix, recursive=FALSE)
    else hashr::hash(x)
}
single_layer_hash <- function(x) {
  purrr::map_int(x, nonrecursive_hash)
}

It would be great if hash.default was able to take recursive=FALSE. It could error if TRUE was passed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions