5 ms·
Lang5 – A Stack Based Array Language
- dang 7y agoRelated from 2018: https://news.ycombinator.com/item?id=17286754 https://news.ycombinator.com/item?id=17286754
- scottlocklin 7y agoKinda neat, but it breaks the APL convention of reading right to left. J version of their example: +/ 1+ i.100 Interesting that it was developed for the HP48: http://archive.vector.org.uk/art10500710 http://archive.vector.org.uk/art10500710
- renox 7y agoGiven that I read left to right usually, I think that this is a good change
- scottlocklin 7y agoPretty 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.
- renox 7y agoUh? 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.
- scottlocklin 7y agoLiterally everyone writes J or K from left to right also: it's not read that way any more than C is.
- quantified 7y agoBeing Forth-inspired, you might expect left-to-right...? It’s more of Forth-with-arrays than APL-with-stacks.
- jdmichal 7y ago> 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 .
- eequah9L 7y agoStack 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.
- codr7 7y agoDup and Swap are all about the two top values though. 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 https://github.com/codr7/gfoo [1] https://github.com/codr7/gfoo#methods https://github.com/codr7/gfoo#methods
- yumaikas 7y agoI'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.
- okaleniuk 7y agoLove 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.
- smabie 7y agoIt should evaluate from right to left, like all other array languages. Looks neat though!
- snidane 7y agoThis is a mistake perpetuated from old array languages. 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: x: 1 + 2 + 3 which would have to be the following in left to right 1 + 2 + 3 :x
- smabie 7y agoI 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.
- LessDmesg 7y agoSo it's a child of a useless curiosity language (Forth) and an extremely niche arcane one (APL). Seems very promising indeed /s
- Afton 7y agoSomeone 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.
- LessDmesg 7y agoSorry, 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.
- Afton 7y agoYou 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.
- 5- 7y agoA different APL in Forth: http://www.cosy.com/CoSy/ http://www.cosy.com/CoSy/
- renox 7y agoWhile I like its 'style', I'm not sure about the Perl5 implementation, is the speed 'good enough'?