-
Notifications
You must be signed in to change notification settings - Fork 74
Function composition operators #125
Comments
how about
https://github.com/pufuwozu/roy/blob/master/lib/prelude.roy#L17 |
@paulmillr it's a straight road down to APL :-) |
@andreypopp imo apl failed because of shitty charset standards back there in 80s. we now have unicode etc. the only thing that concerns me is editor support but it's achievable too. that's what scalaz (quite popular module for scala) also does |
@paulmillr no, just take a look at your keyboard |
I like Paul's suggestion even if I would have to type Ctrl-Shift-2218 for ∘. One tricky thing is that there are lots of very similar Unicode characters and it's difficult to tell which to use. For example, the arrow in src/lexer.js @ 254:11 is U+2192 (→), but I don't see that in http://en.wikipedia.org/wiki/List_of_Unicode_characters. Doesn't mean that Wikipedia is right and Roy is wrong, but it does make it difficult to figure out which Unicode character to use. U+2192 (→), U+27F6 (⟶), U+U+2794 (➔), U+2799 (➙) and U+279D (➝) all seem reasonable to use... |
@andreypopp that's what I meant by editor support, but the resolution is definitely achievable. Scalaz guys use some cool keyboard input source. I mean, it's pretty easy to make new keyboard input sources, so we could just make another one that on ⌥-> will produce →. |
@alsonkemp: In vim, |
For vim I use these bindings https://gist.github.com/2253102 When in insert mode... Although I don't think we should rely on people having their editors set up to support this. I like << since it kind of puts an image in your head of the flow from input to output. |
Just to throw an idea out there, |
I like |
+1 on There's a couple options for Unicode equivalents:
Similarly, would it make sense to have a pipe operator? It's similar to function composition except that instead of adding one more argument at the end of the arguments list, it would put the result as the first argument.
I'm not sure how this would work in the type system, but it would be useful for functions that pass the subject in the first argument and, for example, options in the second. Not sure about Unicode equivalents for this one, though. |
Pipes sound like a good addition to me. So are we cool with these additions/changes:
|
+1 to I would suggest deferring consideration of Which is not to say that Roy should never have them, just that I think it's better to err on the side of a narrower scope for the initial release of the language. |
That's probably a good idea. |
ECMAScript has two right shift operators: the signed right shift operator ( How about |
Good point. I have to wonder though, how often do people use the shift operators in js, and is it less of an issue for someone using roy? |
Wow, I had no idea For what it's worth, given how much more often composition will presumably be used compared to bit shifts, I think it's safe to assume that if My objection to I don't have any strong preferences on |
I noticed that Indeed shift operators are rarely used in JS, many programmers know shift operators. Therefore, if JavaScript programmer sees a Roy code, he/she would think the code is full of shift operators for some reason. |
👍 The |
I'd love to use
.
as the composition operator but might be confusing to have the following be very different:Might be good to have something like
<<
and>>
from F#. Bitwise shift operators in F# become>>>
and<<<
.The text was updated successfully, but these errors were encountered: