Closed sckott closed 9 years ago
@hadley Curious why this is the way it is, Thoughts?
as.domain_record.list <- function(x, domain) { x <- list_to_object(x, "domain_record", name = NULL) if (inherits(x, "domain_record")) { x$domain <- domain x } else { lapply(x, function(y) { y$domain <- domain domain }) } }
Why does the lapply() call assign the domain object to each record, then return the domain? Shouldn't we return the domain record (aka y)?
lapply()
y
As it is now gives
[[1]] <domain> sckottdrop.info ttl: 1800 [[2]] <domain> sckottdrop.info ttl: 1800 [[3]] <domain> sckottdrop.info ttl: 1800 [[4]] <domain> sckottdrop.info ttl: 1800 [[5]] <domain> sckottdrop.info ttl: 1800 [[6]] <domain> sckottdrop.info ttl: 1800
But with the lapply() call returning y we get
[[1]] <domain_record> 2192415 NS NS2.DIGITALOCEAN.COM. [[2]] <domain_record> 2192416 NS NS3.DIGITALOCEAN.COM. [[3]] <domain_record> 2194418 TXT "hey there" [[4]] <domain_record> 2714618 TXT "just chillin" [[5]] <domain_record> 2714621 TXT "just chillin" [[6]] <domain_record> 2714634 TXT "the heck"
Yes, I'd say that's just a think-o.
a think-o?
Like a typo, but with your brain, not your fingers.
ah, right
@hadley Curious why this is the way it is, Thoughts?
Why does the
lapply()
call assign the domain object to each record, then return the domain? Shouldn't we return the domain record (akay
)?As it is now gives
But with the
lapply()
call returningy
we get