[flagged]
Care to elaborate?
APL Interpreter – An implementation of APL, written in Haskell (2024)
21–30 of 75 posts
Re: APL Interpreter – An implementation of APL, written in Haskell (2024)
#22Is there an implementation of an APL language (or other any other array language) written in * readable* C that is around 1000 LoC? There are for LISP, FORTH, Prolog, TCL and the like.
https://www.jsoftware.com/ioj/iojATW.htm
https://github.com/kparc/ksimple/blob/main/ref/a.c
Slightly less factiously, the ksimple repository has a version with comments.
https://github.com/kparc/ksimple
https://github.com/kparc/ksimple/blob/main/a.c
Note, these aren't APL, but they are in the same family of array languages.
Re: APL Interpreter – An implementation of APL, written in Haskell (2024)
#23> Apparently Haskell’s performance isn’t that bad, but I don’t plan on using Haskell for anything that is remotely performance-sensitive. Trying to optimize Haskell code does sound like an interesting problem, but it might be a lost cause. When the dude uses `foldl` over lists and `foldr` with `(*)` (numeric product) it is not the language that's the lost cause.
In case anyone who doesn't know Haskell: both of these are beginner level mistakes. Using `foldl` causes space leaks and turns your O(1) space algorithm to O(N) space for no good reason. And using `foldr` over lists is good when you are dealing with unevaluated lists and want list fusion, but not when they already exist in memory and will continue to do so. And that doesn't even include the obviously wrong choice of…
What's the preffered approach?
Re: APL Interpreter – An implementation of APL, written in Haskell (2024)
#24Earlier quoted context omitted.
Care to elaborate?
Well, you've said you used APL professionally, but judging by https://news.ycombinator.com/item?id=31368299 it was in a university project.
Such poor quality comment.
Re: APL Interpreter – An implementation of APL, written in Haskell (2024)
#25Earlier quoted context omitted.
Care to elaborate?
You built a CPU simulator in APL? Bloody legend! What drove that choice?
We almost got the PDP-11 working albeit some extensions like floating point arithmetic.
Re: APL Interpreter – An implementation of APL, written in Haskell (2024)
#26Earlier quoted context omitted.
Well, you've said you used APL professionally, but judging by https://news.ycombinator.com/item?id=31368299 it was in a university project.
So you go through my profile and assume that you know my professional background? What makes you think that that's the only project where I've used APL? Such poor quality comment.
Re: APL Interpreter – An implementation of APL, written in Haskell (2024)
#27Earlier quoted context omitted.
Well, you've said you used APL professionally, but judging by https://news.ycombinator.com/item?id=31368299 it was in a university project.
So you go through my profile and assume that you know my professional background? What makes you think that that's the only project where I've used APL? Such poor quality comment.
Re: APL Interpreter – An implementation of APL, written in Haskell (2024)
#28Earlier quoted context omitted.
In case anyone who doesn't know Haskell: both of these are beginner level mistakes. Using `foldl` causes space leaks and turns your O(1) space algorithm to O(N) space for no good reason. And using `foldr` over lists is good when you are dealing with unevaluated lists and want list fusion, but not when they already exist in memory and will continue to do so. And that doesn't even include the obviously wrong choice of…
> And using `foldr` over lists is good when you are dealing with unevaluated lists and want list fusion, but not when they already exist in memory and will continue to do so. What's the preffered approach?
`foldr` I almost never use, but it would be for: the return value is a lazy list and I will only need to evaluate a prefix.
Re: APL Interpreter – An implementation of APL, written in Haskell (2024)
#29Re: APL Interpreter – An implementation of APL, written in Haskell (2024)
#30This AoC solution is, indeed, quite the functionista! Better yet, it leans heavily into point-free expressions. The style is pretty popular amongst APL language enthusiasts and puzzlers.
That said, you actually see quite different APL styles in the wild:
- Pointed declarative style, also a popular with functional programmers (e.g. anything like this[0] from the dfns workspace)
- Imperative, structured programming, very common in legacy production systems (e.g. this[1] OpenAI API interface)
- Object-oriented, also common in somewhat newer production environments (e.g. the HTTP interface[2])
- Data-parallel style (e.g. Co-dfns[3])
Heck, APL even has lexical and dynamic scope coexisting together. IMHO, it's truly underrated as a language innovator.
[0]:https://dfns.dyalog.com/c_match.htm
[1]:https://github.com/Dyalog/OpenAI/blob/main/source/OpenAI.apl...
[2]:https://github.com/Dyalog/HttpCommand/blob/master/source/Htt...
[3]:https://github.com/Co-dfns/Co-dfns/blob/master/cmp/PS.apl