Closed DavisVaughan closed 3 years ago
One difference between dbl()
and as_double()
is that the former should use restricted coercion via the .ptype
argument, and the latter should use unrestricted conversions, possibly via a new vec_force()
generic.
Unclear whether we really need as_double()
and vec_force()
instead of single dispatch as.double()
.
I think we need a new flatten()
with the same semantics as in rlang, but generic over S3 lists (is_list(x) && vec_is(x)
) and with name-spec argument.
This feels out of scope for funs for me, since it doesn't seem to be something that you'd commonly use during a data analysis.
I'm not sure if {funs} is the right place for it, but it seems like the
vec()
anddbl()
constructors at the very least could live here. Not sure aboutflatten_vec()
andas_double()
.I think we are all mainly on the same page about what
dbl()
should do, but I wanted to outline implementations for it, and how it would connect tomap()
. Essentially:map_dbl() == as_double(map())
flat_map_dbl() == dbl(map())
I had implemented a rough draft of a new
flatten()
here, but I've since realized it is essentiallyrlang::flatten()
in 99% of the cases, so I've used that below instead.The semantics of
dbl()
here seem to be exactly the same as withrlang::dbl()
, but it goes through vctrs.There are 2 issues that need to be fixed first. I've added them at the end. One with {rlang} and one with {vctrs}.
Created on 2020-01-09 by the reprex package (v0.3.0.9000)