News for hackers. Stuff that matters.
Re:The Janet Language by dvh on Saturday February 18, 2023 @02:10AM (#34844724)
var distance = sqrt(x * x + y * y)

That is something very similar they may had in high school.

Re:The Janet Language by tasuki on Saturday February 18, 2023 @04:06AM (#34845303)
Math notation is familiar, yes. Are you also saying math notation is good? Is it an example to emulate?

I always thought math notation was atrocious to the point of discouraging me from the subject. Who knows, had mathematics used saner (simpler, consistent, perhaps slightly more verbose) notation, I might've been better at it.

Re:The Janet Language by andsoitis on Saturday February 18, 2023 @05:26AM (#34845744)
> Are you also saying math notation is good?

If mathematics notation were as terrible, horrible ad you say, wouldn’t mathematicians have changed it by now?

Re:The Janet Language by gus_massa on Saturday February 18, 2023 @08:14AM (#34846693)
Math notation is terrible! I write like 4 or 6 midterms for Algebra and Calculus for the first year in the university. We are using LaTeX (for most of them), but we need to write LaTeX assuming the copy machine is not very well maintained.

For example, we can't write $e^{-\frac{x}{2}}$ because the minus and the bar of the fraction may not be clearly separated. Also x and 2 will be too small. A solution is to use \dfrac to make them bigger, but the 2D structure of the formula will make the e and 2 be too close and confusing. After some year of trying, one of my coworkers insisted in using $e^{-x/2}$ that is ugly but copy-machine-poof.

We also need huge integrals for $\int_0^7\dfrac{1}{1+x^2}\ dx$. The standard one is too small. I tried to write a macro for that, but the 0 and the 7 must be in weird positions. Also, there are too many cases, because the limits may be missing. Finally, we are using https://ctan.org/tex-archive/macros/latex/contrib/bigints with some tiny macro to rename it to \lint because I don't like the names the author used.

The math notation is very good to write in dead tree paper with a pencil in 2D, but in 1D with a keyboard or automatic processing is horrible.

Re:The Janet Language by wheelerof4te on Saturday February 18, 2023 @07:20AM (#34846352)
Literally a one-liner that is way more readable than whatever that was in the OP example.
Re:The Janet Language by xigoi on Saturday February 18, 2023 @08:04AM (#34846620)
Math notation also features one-letter variable names, weak typing and lots of ambiguity. Do you want those in code?
Re:The Janet Language by eimrine on Saturday February 18, 2023 @12:00PM (#34848466)
> weak typing

Let me disagree! The type is always one, Number (not Int or Float).

Re:The Janet Language by xigoi on Saturday February 18, 2023 @12:08PM (#34848559)
No. There are several numeric types: ℕ, ℤ, ℚ, ℝ, ℂ, … However, mathematicians nearly always implicitly convert between them because having explicit conversions all over the place would be extremely annoying and useless.