Hacker News new | ask | show | jobs
by tomkwong 2210 days ago
Another way to express semantics is the use of Unicode in source code. For example, I have this Julia package that performs Box-Cox transformation, and I was able to use bold face for vector data and greek letters for the parameters as found in research paper and literatures.

https://github.com/tk3369/BoxCoxTrans.jl/blob/master/src/Box...

1 comments

I’ve been conflicted about using verbose names or symbols for mathematical expressions in code, and I don’t think there’s an easy answer for when to use them. For simple arithmetic expressions, it seems like verbose names are superior because it’s easier to derive their meaning and we already understand the operators at play. When translating complex expressions, however, we usually a priori understand the meaning of the expression with our algebraic mental model and it makes sense to use that nomenclature. At the same time though, someone who is unfamiliar with the particular source of the algebra used would find such code quite opaque. For something like the Box-Cox transform I think it makes sense to use the symbols widely employed by the mathematical nomenclature.

This certainly also depends on the language you are using and the ability to define arbitrary in/postfix operations.

It’s also rather annoying to type them, but that’s also probably because I just haven’t developed a workflow for it.

>It’s also rather annoying to type them

I wonder how mathematicians do this, I suppose they use latex notation most of the time, inputting ASCII which is formatted as the symbol instead of looking up tables

> It’s also rather annoying to type them, but that’s also probably because I just haven’t developed a workflow for it.

That's true. I remember hitting C-c and C-v a lot... XD