[R-bloggers] Gold-Mining Week 9 (2019) (and 1 more aRticles) | |
Posted: 30 Oct 2019 09:15 PM PDT [This article was first published on R – Fantasy Football Analytics, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here) Want to share your content on R-bloggers? click here if you have a blog, or here if you don't. Week 9 Gold Mining and Fantasy Football Projection Roundup now available. The post Gold-Mining Week 9 (2019) appeared first on Fantasy Football Analytics. To leave a comment for the author, please follow the link and comment on their blog: R – Fantasy Football Analytics. R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job. Want to share your content on R-bloggers? click here if you have a blog, or here if you don't. This posting includes an audio/video/photo media file: Download Now |
Offensive Programming in action (part III) Posted: 30 Oct 2019 05:00 PM PDT [This article was first published on NEONIRA, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here) Want to share your content on R-bloggers? click here if you have a blog, or here if you don't. This is the third post on offensive programming, dedicated to using offensive programming (OP). You may refer to easy introduction to offensive programming to acquire some basic knowledge about offensive programming, and to discover offensive programming to get access to online materials. Let's see how OP helps in defining function with semantic naming for parameter names, and in providing expected function return type. This will make use of many tools provided by package wyz.code.offensiveProgramming. Focus on a given type suffixLet's consider you want to know more about type suffix 's'. Here is a typical session you could use. A real use caseRaw approachLet's consider following function that helps organizing seats for your friend around the table (under no constraint indeed). Are those calls legal?From a R perspective, obvuously yes. From OP perspective, answer is more subtle and depends on evaluation modes you choose. Evaluation modesCurrently, 3 evaluation modes are supported. They are incremental modes.
Standard R evaluation mode Using, standard_R_evaluation mode brings status, value and mode results. It does not provide any extraneous information than a call in your R console. This mode is provided to ease comparisons. Not to be used solely, indeed. Enhanced evaluation modeThis mode checks function returned value against expected function return type. Using, enhanced_R_evaluation mode brings function_return_type results, as a data.table. The validity column provides information about type concordance between resulting value and expected type. Enhanced evaluation modeThis mode checks parameter values against parameter semantic name specifications. Using, type_checking_enforcement mode brings parameter_type_checks results, as a data.table. Here also, the validity column provides information about type concordance between provided parameter value and parameter semantic name specification. Detail level is one line for each function parameter, to ease discovery of and remediance to uncompliances. So, legal or not ?Let's check them From R point of view, both calls are legal. From offensive programming, only calls returning a status TRUE are valid. Accepting or not the second case is indeed a matter of input scope specification. Does organizing a table for no person have any sense? If your answer is yes, then keep this function definition. If no, how could you improve previous implementation? Refined approachWe will change the parameter name and specify length constraint on it. Note that function body is semantically exactly the same as for previous function. No change in implementation algorithm. Just parameter renaming propagation changes are applied. Now the second case is flagged as invalid from OP point of view. One of the reasons is given explicitly by the parameter_type_check data.table. To conclude …You have
Great, we are more than half the way. Next post will be about registering your own types, and managing your classes and their related functional tests. Stay tuned. To leave a comment for the author, please follow the link and comment on their blog: NEONIRA. R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job. Want to share your content on R-bloggers? click here if you have a blog, or here if you don't. This posting includes an audio/video/photo media file: Download Now |
You are subscribed to email updates from R-bloggers. To stop receiving these emails, you may unsubscribe now. | Email delivery powered by Google |
Google, 1600 Amphitheatre Parkway, Mountain View, CA 94043, United States |
Comments
Post a Comment