Closed zanedp closed 1 year ago
Would it be possible to go even further and write:
R.plot [ "x" => Xs; "y" => Ys ]
I think this would be nice. The only issue is that people might use the =>
operator for something else, so I think if we wanted to include it, it would make sense to put it in a module, so that you have to write:
open RProvider.Operators
And only then you'd see it. If you can do a PR with that (and also adding this to docs), that would be great!
You can now use the => operator by opening RProvider.Operators in release 2.1.0, as suggested above:
open RProvider.Operators
R.plot [ "x" => Xs; "y" => Ys ]
If a function like this were added, the boilerplate necessary for using
namedParams
would be reduced because the need to explicitly callbox
when the values are of different types would be eliminated:That changes:
...to this:
That change lowers the learning curve by eliminating the question "What's
box
?", and looks like dictionary initialization in Ruby, Perl, and PHP. It's a stumbling block for new users when sometimes they do not needbox
, and sometimes they do, especially when the type of a parameter is changed and code that worked with previous data doesn't work with new data because they forgot tobox
.Maybe, including a symbol like this is frowned upon for some reason? If
=>
already has special meaning, maybe a different symbol could be used? (It's not in F# Symbol and Operator Reference.)I can put this in a pull request, but I'm not sure what file is most appropriate.