News for hackers. Stuff that matters.
Re:Abusing the algebra of algebraic data types – why does th... by Jtsummers on Monday October 10, 2022 @12:34PM (#33153451)
> it makes it impossible to just parse an arbitrary expression.

All language suffers from this. Without context (assumed by the reader, provided fully or at least referenced by the writer) all arbitrary expressions are impossible to parse. Tell me what this means:

  map f xs
If you guessed it was mapping the function f over the sequence xs, maybe you're right, maybe not. Maybe a fool wrote it who can't communicate and chose bad names. Maybe an adversarial programmer (wants job security, or is just a dick) uses `map` to mean `reduce` or `mapreverse` (so that it does most of what you expect, but produces a reversed output from what you expect).

Math isn't any different here, don't try to parse arbitrary expressions until you've identified the context. Maybe a fool used notation foolishly, maybe an adversarial mathematician used notation to obfuscate and has, hidden away in their diary, a key that explains it all. But most of the time the context will be provided directly or indirectly. The notation will be explained in the text or the text will be in a field with notational conventions that the reader is expected to know. Same with code, same with every other human language.

Re:Abusing the algebra of algebraic data types – why does th... by squeaky-clean on Monday October 10, 2022 @01:41PM (#33154277)
Sure but I can load any program with that statement into my editor and mouse over each word to view the details or hit F12 to see the definition :p If any of those symbols are undefined, the editor or compiler will tell me.
Re:Abusing the algebra of algebraic data types – why does th... by Jtsummers on Monday October 10, 2022 @02:47PM (#33155053)
Can you? What language is it?
Re:Abusing the algebra of algebraic data types – why does th... by tromp on Monday October 10, 2022 @03:02PM (#33155225)
Looks like Haskell [1]. Other languages may have a predefined function map as well, but few have Haskell's juxtaposition notation for application.

[1] https://hackage.haskell.org/package/base-4.17.0.0/docs/Data-...

Re:Abusing the algebra of algebraic data types – why does th... by Jtsummers on Monday October 10, 2022 @03:22PM (#33155417)
Without context you can assume it is. But you can’t know, which is my point.
Re:Abusing the algebra of algebraic data types – why does th... by squeaky-clean on Tuesday October 11, 2022 @09:53PM (#33171798)
Without context it's not a running program and I don't really care about single lines of code in isolation. It's just as bad as math symbols written in isolation of any context but that's my point.

> If any of those symbols are undefined, the editor or compiler will tell me.

I'm pretty sure every single language in the world will tell me that statement in isolation will not compile.

Re:Abusing the algebra of algebraic data types – why does th... by Jtsummers on Tuesday October 11, 2022 @10:22PM (#33171992)
> Without context it's not a running program and I don't really care about single lines of code in isolation. It's just as bad as math symbols written in isolation of any context but that's my point.

We are either in violent agreement or you are failing to actually convey your meaning.

To take a step back: The original commenter complained about not being able to parse arbitrary expressions. I responded by pointing out that that's not a math specific thing, and that every language has this problem if there is no context. My overall point being that with context that "arbitrary" math expression would become less arbitrary as the context provides meaning which permits parsing. Since they seemed to be a programmer (or have some familiarity with it, asking for a strongly typed language) I provided an expression you might find in some program, and presented it without any context, that was intended as an analogy to their situation with math. Again, trying to emphasize that you need context to get meaning.

You seem to be agreeing with me (you need context for the expression to have any meaning), but your comment itself comes off as argumentative. So what's your disagreement with my point?