Closed vspinu closed 6 years ago
These functions have been marked internal. Their only purpose currently is to prototype C code.
We'll be thinking about a pairlist package, I've been doing lots of pairlist work in https://github.com/lionel-/redpen and https://github.com/lionel-/flowery. Nothing planned for now though.
Their only purpose currently is to prototype C code.
I see that you use them in the main code. So it's not for prototyping only. I do use them to manipulate and construct pairlists and calls because there are no better tools out there except for going C level.
I see that you use them in the main code. So it's not for prototyping only.
It's in the main code but in places that are meant to move to the C side. So it's C code prototyped in R.
You're welcome to create a more user-friendly package for working with pairlists but at this point we're not going to include this kind of functions in rlang. There seems to be little point investing time teaching users why and how to work with linked lists.
Also note that the node pokers have reference semantics but only because of lazy copying. Lazy copying semantics are not guaranteed by the R language so the fact that it works is a bit of an happenstance (though there is no reason to think these lazy copying semantics are going to change).
I just discovered call_modify
which works just fine on pairlists (intended?). I will probably be moving all my stuff on top of it and avoid node_* altogether.
Though splice
doesn't work within but unquoting does:
> call_modify(pairlist(a = 2), !!!(ll(a = 3, b = 3)))
$a
[1] 3
$b
[1] 3
> call_modify(pairlist(a = 2), splice(ll(a = 3, b = 3)))
$a
[1] 2
[[2]]
[[2]]$a
[1] 3
[[2]]$b
[1] 3
It would make sense to have a minimal
stopifnot(is_node(x))
in each of thenode_*
functions. I am crashing R each time I pass wrong type by accident.