Re:Lang5 – A Stack Based Array Language
by jdmichal on Thursday March 12, 2020 @10:28AM
(#22557203)
> Obviously this program [in C] contains a lot of things that deal with the computer and not the problem of calculating a sum.
Stack based languages replace "dealing with the computer" with "dealing with the stack". Except the stack is always invisible, because it's a runtime artifact and not a code artifact. Their front-page example neatly dodges this, but their examples on the about page make this much more visible. For instance, here's their prime finder:
: prime_list
1 - iota 2 + dup dup dup
'* outer swap in not select
;
100 prime_list .
Re:Lang5 – A Stack Based Array Language
by eequah9L on Thursday March 12, 2020 @12:20PM
(#22558396)
Stack is cool as long as it's the top element or two that you care about. Anything more complex, and you want (well, I do) some sort of a binding syntax, so that it is possible to refer to the value symbolically. I find all those swaps and dups impossible to reason about.
Re:Lang5 – A Stack Based Array Language
by yumaikas on Thursday March 12, 2020 @05:09PM
(#22561768)
I've found that there can be some cool stack combinators (like Factor's dip), but binding in stack based languages is nice in that it lets you effectively turn off having to think about the stack in depth, which frees up mental resources for thinking about the problem at hand.
Re:Lang5 – A Stack Based Array Language
by scottlocklin on Thursday March 12, 2020 @09:31PM
(#22563922)
Pretty sure you don't do that in coding. I do in R sometimes because it has ->, but generally speaking, coding is actually done right to left, just like K and Hebrew.
Re:Lang5 – A Stack Based Array Language
by renox on Friday March 13, 2020 @03:55AM
(#22565533)
Uh? No I write code (C++) left to right most of the time, and when I have to do a right to left update, the IDE's stupid autocomplete (vscode but other IDE are the same) keeps making annoying unneeded changes.
Re:Lang5 – A Stack Based Array Language
by okaleniuk on Thursday March 12, 2020 @11:01AM
(#22557558)
Love it aesthetics!
Not sure if it has its niche though. I mean, "stack based" is not really a feature on its own, and we have tons of options to do tensor processing in conventional languages; but the conception is awesome.
Re:Lang5 – A Stack Based Array Language
by smabie on Friday March 13, 2020 @12:24AM
(#22564706)
I think most people would agree that 'a:f g h x' is easier to read than 'x h g f:a'. This may be an artifact from familiarity from math or something else, but I think the point still stands. I've personally never found RPN languages easy to read.
Re:Lang5 – A Stack Based Array Language
by Afton on Thursday March 12, 2020 @02:49PM
(#22560323)
Someone did something because it interested them, and someone posted it here because someone here might find it interesting. So I generally know why those people did what they did. But what about you? Why are you posting what you are posting?
If you have constructive criticism, this is the right place for it, but frankly, you're just being mean on the internet for no reason.
Re:Lang5 – A Stack Based Array Language
by LessDmesg on Friday March 13, 2020 @02:25AM
(#22565205)
Sorry, I don't need your permission. And I'm not being mean, I'm calling out a crappy idea for what it is. If more people did it, the authors of that language and people like them would stop wasting their time making stuff that is a bad idea from the get-go. I'm only providing valuable feedback.
Re:Lang5 – A Stack Based Array Language
by Afton on Friday March 13, 2020 @11:25AM
(#22567992)
You 100% don't need my permission. But even if your feedback as valuable, couching it in this kind of language isn't. Also, just telling someone that their idea is shitty, even if true, isn't valuable feedback without a discussion of why it's shitty.
Anyway, since you seem to be doubling down on being an asshole, I don't intend to reply again here.
Stack based languages replace "dealing with the computer" with "dealing with the stack". Except the stack is always invisible, because it's a runtime artifact and not a code artifact. Their front-page example neatly dodges this, but their examples on the about page make this much more visible. For instance, here's their prime finder:
Otherwise I strongly agree, I like to use bindings for anything non-obvious.
In my own designs [0] I tend to add named arguments [1] as well, which helps a lot.
[0] https://github.com/codr7/gfoo
[1] https://github.com/codr7/gfoo#methods
+/ 1+ i.100
Interesting that it was developed for the HP48:
http://archive.vector.org.uk/art10500710
Not sure if it has its niche though. I mean, "stack based" is not really a feature on its own, and we have tons of options to do tensor processing in conventional languages; but the conception is awesome.
Evaluation from left to right is more natural to people using latin alphabet.
It's totally arbitrary anyways. I suspect the only reason why there is right to left evaluation in APL family is to support assignment like this:
which would have to be the following in left to rightIf you have constructive criticism, this is the right place for it, but frankly, you're just being mean on the internet for no reason.
Anyway, since you seem to be doubling down on being an asshole, I don't intend to reply again here.