4 ms·
R works exactly as you describe. You can type `+`(1, 2) and get 3 because in R everything that happens is a function call even if a few binary functions get spe
by wdkrnls 1y ago
R works exactly as you describe. You can type `+`(1, 2) and get 3 because in R everything that happens is a function call even if a few binary functions get special sugar so you can type 1 + 2 for them as well. The user can of course make their own of these if they wrap them in precents. For example: `%plus%` = function(a, b) { `+`(a, b)}. A few computer algebra systems languages provide even more expressivity like yacas and fricas. The later even has a type system.
- seanw444 1y agoSimilar in Nim as well.
- ckmate-king-2 1y agoIn Standard ML, you can do either 1+2 or op+(1, 2).
- int_19h 1y agoR is much crazier than that because even things like assignment, curly braces, and even function definitions themselves are all function calls. It's literally the only primitive in the language, to which everything else ultimately desugars.