3 ms·
> Do you think the APL family can exist without the terse syntax? Are there any aspects of the language that just wouldn't work well without it? Considering th
by avmich 11y ago
> Do you think the APL family can exist without the terse syntax? Are there any aspects of the language that just wouldn't work well without it?
Considering the evolution of APL, yes.
Ken Iverson was teaching math in Harvard, when he was growing the - mathematical - notation to describe the subject formally. It was happening in late 1950's, and the computers were entering our life. At some point it became reasonable to use that evolved notation as A Programming Language - or APL, for short.
However, the idea was to make understanding easier - all along! Same idea which Alan Kay is pursuing with his works, same idea with many good technologies, when they are young - Java, JavaScript... Importance of notation - be it in math, or in formal-and-executable-math is the ideology of early APL. Now they say "it's hard to beat expressiveness of a whiteboard", but still attempt to use, say, an integral sign (and, similarly, one-letter variables), as one would do when showing the idea on a whiteboard. The history of hand-written math preferred terse notation - and that is carried on in APL as executable math.
So... yes, terseness is important, and APLers will also say that choice of symbols is important too. It's only to beginners that they feel strange - pretty soon programmer learns them, gets used to them and refuses to substitute them with more readable longer variants - even though that would make certain things better. You don't name variables on a whiteboard with long_names or camelCase - at best you use sub- and superscripts. Granted, you can have cups and power towers and other things, and they were really impractical with 1960's level technologies... yet at least you have a singular text direction for expressions, in editors or in print.
J makes certain things more logical, and switches to ASCII. May be we'll invent even better notation (to me, this - http://matt.might.net/articles/discrete-math-and-code/ http://matt.might.net/articles/discrete-math-and-code/ - looks like a good start to think about basic building blocks), but so far, we have APL family languages as arguably closest thing to math notation. To some, it's the closest way they can imagine between making a solution in the head and explaining that to computer.
- dang 11y ago> It's only to beginners that they feel strange - pretty soon programmer learns them, gets used to them and refuses to substitute them with more readable longer variants That reminds me of how McCarthy always intended to replace S-expressions with M-expressions, but it never happened because programmers found they liked the S-expressions after all.
- eggy 11y agoI believe Shen [1] creates m-expressions when certain expressions are passed through its compiler. Shen should appeal to Haskellers and Lispers I would believe. Deech has created a Shen port for elisp [2], and it exists on many other language platforms, because it runs on an enriched lambda calculus called Klambda implemented in a small set of functions. [1] http://shenlanguage.org/ [2] https://github.com/deech/shen-elisp
- eggy 11y agoIn agreement with @avmich above, and to turn the question around from above: > Do you think the APL family can exist without the terse syntax? Are there any aspects of the language that just wouldn't work well without it? Do you think mathematics would exist or be shared and done as efficiently if it did away with the terseness of its symbols, Greek letters, etc...? Yes, in J you can define average as: +/%# so that, (+/%#) 2 3 4 5 returns 3.5 Or, avg=: +/%# avg 2 3 4 5 returns 3.5 Or, sum =: +/ divided_by =: % tally =: # So, if you want to take baby steps into J you can: avg=: sum divided_by tally avg 2 3 4 5 returns 3.5 But, that defeats the purpose of being able to concisely manipulate abstractions to get work done for the sake of readability, and ONLY for those people who refuse to learn the symbols as in mathematics. Have you ever heard from an adult who has had basic mathematics say, 'I have to keep looking up that greek letter π'? It only takes me a very little while to review my concise code. I'd rather learn this sort of pattern recognition of short code when dealing with high abstractions to the spaghetti-like appearance, to me, of Java or C (I like C!). Strangely enough I find Lisp more clear to C-like langs. It may be more than just subjective preference, but order of reasoning in the syntax.
- gd1 11y agoYou are exactly right. My favourite is when resistance to APL-family languages comes from people who claim to be polyglots, and you ask them which languages and they list: C, C#, java, javascript, VB, ruby, python etc. Those are all really the same language with slightly different wording and details. Like german and english. APL-family is like Mandarin or Japanese. Lisp is like Latin (in fact lisp is really a mechanism to author your own language with s-exprs). Obviously, these languages won't be comprehensible to you until you put the effort into learning the abstractions... this isn't like transitioning from C++ to Java where you can broadly carry the same concepts over. There is nothing difficult about reading these languages to people who use them, anymore than it is difficult for a musician to read sheet music. In fact, APL languages have less ambiguous parsing and precedence rules which I find make them easier to read.
- vidarh 11y ago> Those are all really the same language with slightly different wording and details. Like german and english. I'd argue you only think that because they've opted for a familiar syntax. E.g. the object model (or lack of one) is vastly different between these languages and they employ drastically different type systems. Ruby is closer to Smalltalk than C in most respects other than syntax, for example, and provides most of the abilities lisp gives you, including the ability to define domain-specific languages. The major aspect you're not getting from Ruby would be homoiconicity. Here's and article comparing Lisp and Ruby[1]. I'm not saying learning languages outside of this group isn't important, but that a lot of the reason why languages like Lisp and APL are seen as so different has more to do with syntax than semantics. Most people don't know what the semantic differences even are, because getting past the alien syntax is too much effort. When you do, the differences aren't all that huge. [1] http://www.randomhacks.net/2005/12/03/why-ruby-is-an-acceptable-lisp/ http://www.randomhacks.net/2005/12/03/why-ruby-is-an-accepta...