Live data from Hacker News

APL deserves its renaissance too

wordsandbuttons.online

111–120 of 123 posts

Re: APL deserves its renaissance too

#111
post #73

Earlier quoted context omitted.

If you think about it, a decent stack is composed of languages. That's currently already often true, e.g. the use of IDL languages like protobuf/flatbuffers. Some languages offer integrated idl like Kotlin (data classes). Another example is html, where the UI is described using a dsl to specify elements and CSS for layout & appearance. This fact caused me to think: should stack also not be made of other languages? Is…

The ML family (SML, Ocaml, F#) is also pretty good with the mixture of functional and imperative constructs. Having a part of the program known to be pure at compile-time, but another part effectful is something you see in the language F* ( http://fstar-lang.org ) - here you get monads, dependent types, a proof system, and the ML module system neatly packed into a general-purpose programming language. Not as widely p…

The heart of my argument is mostly that integration in main languages should be pursued. F# can be mixed on assembly (project) level, but not on source level (like css in html or html in js/ts).

Re: APL deserves its renaissance too

#112

No, it does not. I used APL professioally for about ten years back in the 80's. I love the language. It is incredibly powerful. Once you internalize it's like playing the piano, you don't think about the mechanics you play music. However, the language did not stand the test of time for far more important issues than the inconvenience of the character set and the keyboard. And, no, J is not a successor to APL, even th…

Could you go into more detail about your opinion of J? I have not seen any negative opinion about it before and I am very curious as to what issues you believe it to suffer from.

Re: APL deserves its renaissance too

#113
post #110

Earlier quoted context omitted.

>> In the early 80's I experimented with Prolog. Simple ideas were simply coded into programs; it was really very interesting. However, the need to understand the compiler's inner workings to get programs that ran efficiently by manually inserting "cuts" to limit backtracking ruins Prolog's claim to being simple to translate requirements into programs. Where does this claim come from? Prolog is an automated theorem p…

Yes, thanks for the correction. You are right, it is possible to learn to Prolog without understanding the inner workings of the compiler or even the Warren Abstract Machine, but that is how I understood why I had to put up with the cut operator in my programs. I was originally sold on the idea of Prolog because of the many beautiful declarative examples found in introductory tutorials. The sad truth is that Prolog i…

>> This expects programmers to have a non-trivial understanding of Prolog's implementation. I was wrong to say that an understanding of the compiler was needed, but programmers do have to understand unification and the order of evaluation used by the language.

Actually, I'd go one step further and say that in order to make full use of Prolog you need to understand SLD resolution and definite clauses, otherwise you'll never really get what the hell is going on in there, or why the interpreter works the way it works. To program in Prolog you do need a non-trivial understanding not only of its implementation but also of the substantial theoretical work that led to its implementation as the prototypical logic programming language (e.g. see J. W. Lloyd, Foundations of Logic Programming).

The thing is, there is a lot more going on with Prolog than "here is a language that can be used to control a digital computer". Logic programming is the continuation of the work of the logicians of the early 19th century, the evolution if you like of mathematical logic. It has to be understood in that context- or not at all.

You make the point that there is an operational, or imperative, reading of Prolog code, that must be understood alongside the declarative one. That is correct, in my opinion, but I don't see why it's a problem. For one thing, programmers taught on imperative languages (i.e. the majority) should not really have a problem with the operational semantics of Prolog (e.g. what you see when you trace Prolog code in the four-port tracer, the order in which goals are called, succeed, fail and are retried etc). Understanding the semantics of the cut is maybe not trivial, but again that is a problem only if someone tried to sell you Prolog as an "easy" or "friendly" language; which it isn't.

More importantly, Prolog has its declarative reading also, which is something almost unique to it. So maybe Prolog is not a perfect, pure implementation of the declarative paradigm- so what? Should we throw the baby out with the bathwater and say, hey, Prolog is only 99% declarative, so I'll just stick with Java, which is 0% declarative? That doesn't make much sense! At least not if you somehow want to use declarative programming- if not, then Prolog is not an option anyway.

>> Finally, I believe that the cut operator also makes parallel processing implementations of Prolog very difficult.

You mean parallel execution of Prolog code? Not parallel implementations of the language? I don't see that the cut is a problem there, but then again I don't have any experience trying to parallelise Prolog code. There is again a promise that Prolog's execution scheme is uniquely disposed to parallel execution. Maybe it is, maybe it isn't. But that is not the most important characteristic of Prolog.

The most important characteristic, like my previous comment says, is that Prolog is an automated theorem prover for first-order logic theories. Anything else that it may do is by the by- and, conversely, any compromise it has to do on the way there, provided we're talking about pragmatic compromises necessary to get the language to work on limited resources (i.e. like the cut), is worth it.

Of the sources you quote I'm familiar with Clocksin & Mellish, Bratko and Sterling & Shapiro. Those are good books, although Bratko probably tries a bit too hard to make Prolog sound a bit like Pascal. I would also recommend Richard O' Keefe's The Craft of Prolog and George Lugger's "AI Algorithms, Data Structures, and Idioms in Prolog, Lisp, and Java", online here:

http://wps.aw.com/wps/media/objects/5771/5909832/PDF/Luger_0...

>> Perhaps Logic Programming will make a comeback aided by the new advances in automated theorem proving.

Nah, I don't think so. I think it will remain a niche thing, of interest primarily to academics and programmers who like obscure languages. But that's OK. Not every language needs to be Java or Python.

Re: APL deserves its renaissance too

#114

Earlier quoted context omitted.

I agree that Haskell is a good comparison. I think matrices and math are too closely focused on in array languages (and dismissals of array languages), though. For fun I'm writing a "spreadsheet programming language" that borrows a little from array languages, and I think there's useful stuff to take away from them. They make you focus on the data, and the transformations you want to effect on the data. They make you…

You can do that last one pretty easily in JS with a helper function. function by (key) { return function (obj) { return obj[key] } } // sort(people, by('age'))

Not a bad solution. Having a top-level `by` function isn't a bad tradeoff if it's easily understood. For me there are two problems, though. Most importantly:

1. It doesn't generalise past lookups. Say I want to sort a list of numbers by their absolute value. In my spreadsheet language:

  sort(numbers, by: abs(numbers))
or filtering by some threshold:

  filter(numbers, by: numbers > threshold)
Both are "repetitive" -- we might prefer something with first-class functions to get closer to a point-free style, but my users won't care. And the repetition isn't actually useless, there are times you might really want that flexibility:

  filter(users.id, by: users.age > 21)
2. My language isn't big on first-class functions. One day it might get support for them for some use-cases where you just need that flexibility[1], but in the meantime they don't provide a lot of value, and they're not a good fit for my hypothetical future users.

If I told my hypothetical users that `by` returns a function, their response would probably be, "What is a function?" The unit of logic abstraction in my spreadsheet language is... slightly weird from a traditional programming perspective.

Thanks again for commenting constructively, though -- seeing a new ergonomic way to approach this sort of problem (or even just "tricks that could become idioms") is really useful.

[1]: If you needed to provide a 2-arg comparator to `sort` then a lambda would be much better -- my scheme would require you to evaluate the cross-product of comparisons, so sorting would have to take time O(n^2), which is no good. Thankfully single-item key functions seem sufficient for most purposes.

Re: APL deserves its renaissance too

#115

Earlier quoted context omitted.

The beam-spring keyboards are still being made - someone bought the patents, tooling, and supplies from IBM and their main supplier, 22 years ago and has been making them ever since. http://www.pckeyboard.com/page/category/UKBD

Yeah, he's speaking of the Model F variant of keyboards from IBM rather than the Model M (the better known buckling spring variant). There are a ton of Model F's online for sale because they're not natively compatible with regular computer and thus need an adapter (I believe), and they're just not as widely known. Also the Model F is a monstrous beast of a keyboard, that would make even a regular model M seem compact…

Beam-spring > buckling-spring Model F > buckling-spring Model M.

The guys at Unicomp were musing around the Space Saver layout. Not sure if they have the machinery, or the funds, to do the tooling to build it.

Re: APL deserves its renaissance too

#116
post #34

I keep hearing APL is great, but like everyone else I find the cryptic symbols very off-putting. I haven’t seen a really compelling explanation for why it’s great. It looks like a bunch of matrix and vector functions with very terse names. Is it significantly different from just taking GLSL, say, and #define-ing one-character names for all the built-in functions? What is APL’s secret sauce? This article suggests that…

If you don't like the symbols then there are J and K/Q which are ASCII based but retain many of APLs other characteristics. https://en.wikipedia.org/wiki/J_(programming_language) https://en.wikipedia.org/wiki/K_(programming_language)

I just don't think the symbols are all that important. I'm curious about the key ideas behind the language, but I haven't seen a really good explanation of them.

Is it just a set of well-chosen matrix operators? I would have thought that could be done in a library, rather than a language.

Re: APL deserves its renaissance too

#117
post #34

Earlier quoted context omitted.

If you don't like the symbols then there are J and K/Q which are ASCII based but retain many of APLs other characteristics. https://en.wikipedia.org/wiki/J_(programming_language) https://en.wikipedia.org/wiki/K_(programming_language)

I just don't think the symbols are all that important. I'm curious about the key ideas behind the language, but I haven't seen a really good explanation of them. Is it just a set of well-chosen matrix operators? I would have thought that could be done in a library, rather than a language.

There are two key ideas: one is notation as a tool of thought, and thus the symbols are incredibly important (or, if not using symbols, to use similarly lightweight notation as in j/k).

In a semantic sense, the key idea is that you compose operations on array indices. A good example of this is k's where operator, &, which converts an array of booleans into an array of indices where it is true. It's very common to take & of some predicate on your inputs, manipulate that for a while, and then index into something else at the end.

There are also ideas of rank/shape ambivalence, which naturally encompasses broadcasting (so scalar + vector broadcasts the scalar, vector + matrix broadcasts the vector row-wise, etc).

You certainly can implement something with APL's semantics as a library - Numpy does this. The magic of using APL comes from having all these features at once.

Re: APL deserves its renaissance too

#118
post #117

Earlier quoted context omitted.

I just don't think the symbols are all that important. I'm curious about the key ideas behind the language, but I haven't seen a really good explanation of them. Is it just a set of well-chosen matrix operators? I would have thought that could be done in a library, rather than a language.

There are two key ideas: one is notation as a tool of thought, and thus the symbols are incredibly important (or, if not using symbols, to use similarly lightweight notation as in j/k). In a semantic sense, the key idea is that you compose operations on array indices. A good example of this is k's where operator, &, which converts an array of booleans into an array of indices where it is true. It's very common to tak…

Great, thank you! Food for thought and some concrete stuff to research further.

Re: APL deserves its renaissance too

#119
post #84

No, it does not. I used APL professioally for about ten years back in the 80's. I love the language. It is incredibly powerful. Once you internalize it's like playing the piano, you don't think about the mechanics you play music. However, the language did not stand the test of time for far more important issues than the inconvenience of the character set and the keyboard. And, no, J is not a successor to APL, even th…

I find both APL and Forth fascinating. I would not try to promote them as a replacement for newer more approachable languages, but I think that learning them gives you different points of view and are worth learning for every programmer (same with FP, for example).

Yes, APL and Forth are excellent in this regard. They give you a very different set of mental tools with which to solve problems computationally.

Re: APL deserves its renaissance too

#120
post #56

No, it does not. I used APL professioally for about ten years back in the 80's. I love the language. It is incredibly powerful. Once you internalize it's like playing the piano, you don't think about the mechanics you play music. However, the language did not stand the test of time for far more important issues than the inconvenience of the character set and the keyboard. And, no, J is not a successor to APL, even th…

> Finding qualified programmers and having access to libraries so you don't reinvent the wheel. Lots of niche languages have the same problem, notably lisp, but it doesn't do to say they aren't popular for those reasons. It's circular reasoning. Languages get those things by being popular. They get popular by having those things. Every current "popular" language with good libraries and a large userbase started with n…

> It's circular reasoning. Languages get those things by being popular.

Maybe it is but it's reality. Also, there's the other kind of reality: Languages don't matter. Solving problems is what matters.

I've programmed in everything from Machine Language (note I did not say "Assembler") to APL, passing through languages like Forth, C, C++, FORTRAN, Objective-C, Lisp, PHP, JS, Python, etc. At the end of the day the ONLY thing that matters --if it isn't a hobby-- is solving problems computationally. I have no cult adherence to any language whatsoever. They are tools, that's all.

My best example of this was making tons of money solving a problem using Visual Basic for Applications, which allowed me to use Excel to automate a time consuming task in a CAD program. It just so happened that this CAD program could be automated using VB. Put the two together and several months of work and we had a tool worth quite a bit of money.

APL still has lots of value...in the right circles. I believe it still sees professional usage in the finance industry.

Post reply on HN