3 ms·
92 `div` 10 > I think this is pretty ugly, and it feels like it was glommed on to the language in some kind of compromise. For div specifically, you can use th
by MaxGabriel 11y ago
92 `div` 10
> I think this is pretty ugly, and it feels like it was glommed on to the language in some kind of compromise. For div specifically, you can use the operator / to achieve the same thing, but this won't work for all other functions.
I don't see what's wrong with backticks for infix functions; they highlight a change in fixity that makes it easier to see that `div` is being applied to the surrounding arguments rather than being used an an argument:
a div b
a `div` b
I'm not familiar with other languages that have support for named, infix functions. Are there better syntactic alternatives?
- spion 11y agoI think its the backquotes. For a time I thought that a :div: b would look better, but now that I'm used to the backquotes, I'm not so sure.
- evincarofautumn 11y agoYeah, grave accents are not exactly designed to be used as quote characters.
- MaxGabriel 11y agoThey're commonly used as such in several programming languages (https://en.wikipedia.org/wiki/Grave_accent#Use_in_programming https://en.wikipedia.org/wiki/Grave_accent#Use_in_programmin...), though, including Bash, D, Go, Ruby, MySQL, Markdown, etc.
- evincarofautumn 11y agoI don’t like them here or there. I don’t like them anywhere.
- chrisaycock 11y ago> I'm not familiar with other languages that have support for named, infix functions. Are there better syntactic alternatives? A "dyadic function" in q/kdb+'s .q namespace has a kind of Currying that accepts the right-hand value as the second argument to the function. (This is abusive in practice since the user should never add to the .q namespace as future conflicts are possible.) .q.add:{x+y} 5 add 10
- marcosdumay 11y agoI also take issue with this part: > you can use the operator / to achieve the same thing, but this won't work for all other functions Yes, it will work for all other (binary) functions. If there isn't an operator at the Preface, just declare one. Anyway, I'll have to agree with people further down. Using the grave accent as a stand-alone symbol in a language is a big mistake.