News for hackers. Stuff that matters.
Re:R adds native pipe and lambda syntax by f6v on Saturday December 05, 2020 @01:40PM (#25317033)
AFAIK the same as in Julia.
Re:R adds native pipe and lambda syntax by kkoncevicius on Saturday December 05, 2020 @01:41PM (#25317047)
I think that symbol is used as an approximation of "lambda" character (λ) on a standard US keyboard.
Re:R adds native pipe and lambda syntax by desine on Saturday December 05, 2020 @01:56PM (#25317211)
It 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.
Re:R adds native pipe and lambda syntax by boogies on Saturday December 05, 2020 @02:29PM (#25317529)
IMO 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...).
Re:R adds native pipe and lambda syntax by LoathsLights on Saturday December 05, 2020 @10:58PM (#25320901)
Now 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.
Re:R adds native pipe and lambda syntax by boogies on Monday December 07, 2020 @11:15AM (#25333529)
> Now imagine doing that same thing for every system you're programming on.

As a matter of fact, I already do, the XCompose way.

  yadm clone /path/to/dotfiles/repo.git¹
As for the vim way, why would I use a system without vim²?

> And then imagine having to do it for a million different symbols.

I don’t know other symbols as useful as this, but sure, either of my solutions scales fine (`yadm clone` shouldn’t get bogged down by any repo smaller than the Linux kernel’s). My system's /usr/share/X11/locale/en_US.UTF-8/Compose already has a section for APL’s symbols out of the box.

¹yadm is dumb by the way, any symlink manager + git/hg is probably better

²As it so happens, I do: because vim is bloat and https://sr.ht/~martanne/vis/ fits much better in the ramdisk my OS always runs in — but I’d bet 99.99% ±0.009% of programmers install their OS on an HDD/SSD and don’t care.

Re:R adds native pipe and lambda syntax by thotsBgone on Sunday December 06, 2020 @02:20AM (#25321791)
A 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).
Re:R adds native pipe and lambda syntax by BigJono on Sunday December 06, 2020 @03:04AM (#25321944)
No, 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.

Re:R adds native pipe and lambda syntax by thotsBgone on Sunday December 06, 2020 @05:06PM (#25327061)
How is it different than the word "function"?
Re:R adds native pipe and lambda syntax by BigJono on Sunday December 06, 2020 @05:21PM (#25327178)
It's not, that's why people use arrow syntax in languages like Javascript for short in-lined functions.
Re:R adds native pipe and lambda syntax by michaelhoffman on Saturday December 05, 2020 @02:34PM (#25317574)
In Windows, WinCompose lets you set up compose keys like that, although the default ⋄yy goes to ʎ.
Re:R adds native pipe and lambda syntax by dash2 on Saturday December 05, 2020 @04:47PM (#25318729)
I don’t think R yet has native Unicode support on every platform.
Re:R adds native pipe and lambda syntax by johannes_ne on Saturday December 05, 2020 @01:50PM (#25317151)
Here is a tweet thread explaining this: https://twitter.com/rabaath/status/1335226691304775681?s=20
Re:R adds native pipe and lambda syntax by improbable22 on Saturday December 05, 2020 @03:09PM (#25317836)
Julia's lambdas look like `x -> f(x,2)`, with no backslashes.

The pipe `x |> f` is indeed the same.