Comment by xyzsparetimexyz
5 hours ago
I'd have just written this as a Python library that lazily evaluates expression via numpy personally. The API is useful, language is not
5 hours ago
I'd have just written this as a Python library that lazily evaluates expression via numpy personally. The API is useful, language is not
People do this kind of computation using numpy all the time. If you weren’t developing a new language with a new syntax, there really isn’t much of a library to write. At that point it’s just using numpy.
the language can do a lot of very expressive things, every language feature works in your favor too, but agree with you, i would not use my own language for anything production.
like this:
D ~ unif_int(1, 6); Print("P(rolled a 6 | rolled > 3) =", P(D == 6 | D > 3));
or:
loss ~ unif(0, 1000); claim = if loss > 200 { loss - 200 } else { 0 }; p = P(claim > 0); Print("P(insurer pays a claim) =", p)
notice that "claim" is also a random variable! result of a if expression
Yeah sure this is how numpy people would do it:
It’s concise enough that people generally wouldn’t bother writing a library. Unless they really want their custom syntax, then perhaps they write a parser.
that has some technical limitations. For example, their impl can compile to wasm, which makes giving an online interpreter simpler/lighter weight than relying on running python in the browser.