# Create a structure vector with duplicates
core1 <- o_glycan_core_1()
structures <- c(core1, core1, core1) # same structure 3 times
# Only compute once for the unique structure
unique_results <- smap_unique(structures, igraph::vcount)
length(unique_results) # 1, not 3
# Use purrr-style lambda
unique_results2 <- smap_unique(structures, ~ igraph::vcount(.x))
length(unique_results2) # 1, not 3
Run the code above in your browser using DataLab