6 ms·
That backslash syntax is pretty funky, but then again all of R is a little funky. Very nice addition to the language though!
by burlesona 6y ago
That backslash syntax is pretty funky, but then again all of R is a little funky. Very nice addition to the language though!
- f6v 6y agoAFAIK the same as in Julia.
- kkoncevicius 6y agoI think that symbol is used as an approximation of "lambda" character (λ) on a standard US keyboard.
- johannes_ne 6y agoHere is a tweet thread explaining this: https://twitter.com/rabaath/status/1335226691304775681?s=20 https://twitter.com/rabaath/status/1335226691304775681?s=20
- desine 6y agoIt is, and it's not the first language to use it as such. But for many programmers it always triggers the 'escape' alarm in the mind, and it will always cause slight discomfort seeing it used in the raw.
- boogies 6y agoIMO it should be like Fennel and just support `lambda` and `λ`. The latter is not even that hard to type, in virtually any free (libre) OS you can just $ echo ' <Multi_key> <Y> <Y> : "Λ" # GREEK CAPITAL LETTER LAMDA <Multi_key> <y> <y> : "λ" # GREEK CAPITAL LETTER LAMDA ' >> ~/.XCompose If you’re limited by a nonfree OS you should be able to patch the problem with free duct tape like Karabiner or AutoHotKey. And in vim you can just <C-K>*l in insert mode (which can be done with option-l on macOS if you `inoremap ¬ <C-K>*l` https://apple.stackexchange.com/questions/230422/type-lambda-%ce%bb-on-a-mac#comment556351_230439 https://apple.stackexchange.com/questions/230422/type-lambda...).
- michaelhoffman 6y agoIn Windows, WinCompose lets you set up compose keys like that, although the default ⋄yy goes to ʎ.
- dash2 6y agoI don’t think R yet has native Unicode support on every platform.
- LoathsLights 6y agoNow imagine doing that same thing for every system you're programming on. And then imagine having to do it for a million different symbols. I'm sure as hell glad you're not in charge of any of this.
- thotsBgone 6y agoA better solution is just to use the word 'lambda', and let your text editor render it as a lambda symbol if you want (my emacs does this).
- BigJono 6y agoNo, that's a shithouse solution. Everyone that doesn't have a fancy IDE now has 6-8 extra useless characters for something that should be syntax.
- thotsBgone 6y agoHow is it different than the word "function"?
- BigJono 6y agoIt's not, that's why people use arrow syntax in languages like Javascript for short in-lined functions.
- boogies 6y ago
- improbable22 6y agoJulia's lambdas look like `x -> f(x,2)`, with no backslashes. The pipe `x |> f` is indeed the same.
- bachmeier 6y agoBorrowed from Haskell. (Which of course does not make it unfunky.) https://wiki.haskell.org/Anonymous_function https://wiki.haskell.org/Anonymous_function
- lottin 6y agoIn R all functions are anonymous functions. Functions are created anonymously and then (usually, but not always) assigned to a variable using the assignment operator.
- joelthelion 6y agoI must say I don't really see the point, given that function() does the same thing, with only a few more characters.
- deleted 6y ago[deleted]
- smabie 6y agothat's a lot more characters. useless, unnecessary characters I might add.