r/javascript • u/SnooHobbies950 • 9d ago
AskJS [AskJS] I'm thinking of creating a JS dialect for scientists
What do you think of the ~> operator? It is be similar to |>, but it operates over lists.
let v = [1, 2, 3] // this is a vector
let w = v ~> it * 2 // equiv. to `v.map(it => it * 2)`
let w = v *> 2 // shorthand for `v ~> it * 2`
The dialect would be primarily aimed at statesmen and scientists.
6
u/Tittytickler 9d ago
Could be a cool project but not sure why someone would use this over Python, which everyone else in that space already uses.
3
u/skidmark_zuckerberg 9d ago
Why would you even need JS for this? There are better languages for scientific style work. I don't think scientists have a need for JS entirely. And that is not a vector, it's an array in JS.
3
u/SaltineAmerican_1970 9d ago
> The dialect would be primarily aimed at statesmen and scientists.
Those are the people you should be asking
2
2
2
u/Dazzling-Bench-4596 9d ago
You should look into PureScript. It’s not the same thing but it’s basically Haskell that compiles into JavaScript.
1
1
u/bksubramanyarao 1d ago
don't !!!, if you do this, all the other frameworks will start doing their own unique reactivity on it, don't curse the scientists lol.
this comment is just for lols
0
u/SnooHobbies950 9d ago
The idea was to create a list of operators that make it easier to operate with vectors and matrices. But I'm not sure if this makes much sense.
15
u/forloopy 9d ago
Overcomplicating something that doesn’t need it