Array languages for Lisp programmers (2010)
archive.vector.org.uk
archive.vector.org.uk
This kind of flexibility is not specific to the functions that come in the standard library. It's part of the language semantics, so it applies to every function the programmer writes. That's a fair bit harder to package up as a library (I've done it in Racket by more or less temporarily redefining function application), so I tend to be dubious of claims to have brought this paradigm into another language. Array-oriented programming is not just a combinator library.
I agree, and that's unfortunate because that's not the most differentiating thing about array languages. As you point out, it is the semantics: some of it appears in other functional languages (like doing away without loop constructions) but some are unique to array languages (like using various properties of matrix/vector operations to express certain computations concisely).
I am a big believer of linear algebra as a great tool of thought for computation that most people have little to no knowledge of, and the APL family (and actually, Excel) brings home this point.
EDIT: And I definitely speak from my experience. I was a professional q programmer for two years, and I came to realize what makes q difficult for many people is not just its cryptic notation but also the general lack of understanding of linear algebra/matrix operations.
K
\c 150 100
c:{$[0=x-5*x div 5;$[0=x-3*x div 3;"CracklePop";"Pop"];$[0=x-3*x div 3;"Crackle";x]]}'1_!101
r:{x@&~x in "\""}
p:{-1 r .Q.s x}
p c
\\
q (the "readable" wrapper around K4") \c 150 100
c:{$[0=x mod 5;$[0=x mod 3;"CracklePop";"Pop"];$[0=x mod 3;"Crackle";x]]} each 1_til 101 -1 ssr[.Q.s c;"\"";""]
\\
Here’s a python (2.7) version of the program written in as unreadable as I could muster for i in map(lambda x: "CracklePop" if not x % 3 and not x % 5 else "Crackle" if not x % 3 else "Pop" if not x % 5 else x, xrange(1,101)): print i
Here it is in normal python (2.7) for x in xrange(1,101):
if not x % 5:
if not x % 3:
print "CracklePop"
else:
print "Pop"
elif not x % 3:
print "Crackle"
else:
print x[1] http://www.eecg.toronto.edu/~jzhu/csc326/readings/iverson.pd...
No, I am not kidding. Excel, or spreadsheets in general, is a great, readily available environment to learn how to think like an APL programmer. Sure, the notations are not there, and you will be copy-and-pasting cell references as opposed to typing in obscure operators, but the essential idea is there: how to think about computation in a geometrical/tabular way.
The novelty of array languages lie not just in their semantics of acting on collections rather than items at a time. They shine when their interpreters are especially tuned for this use case. So in spite of being interpreted, these languages can be quite fast because once the interpreter dispatches to a(n ideally) hefty primitive that operates on collections, the interpreter gets out of the way for a while.
These languages are designed to express and, critically, also exploit low
(interpetation workload) / (computation workload)
This is a similar to the notion of minimizing communication per computation.Assuming this post will attract some array language experts, may I ask what happened to Nial ?
@sedachv If you arent familiar already, Manticore might interest you. http://manticore.cs.uchicago.edu
SERIES had a lot of early work in deforestation and almost made it into the Common Lisp standard: http://series.sourceforge.net/
I want to see NESL (http://www.cs.cmu.edu/~scandal/nesl.html) brought back for modern systems. Even StarLisp (http://en.wikipedia.org/wiki/*Lisp) makes Hadoop look absolutely retarded.
I'm interested in how exactly implement this stuff. Somebody suggest this link: http://sblom.github.io/openj-core/ioj.htm
I haven't digest it yet, but I wonder if exist a more "normal" implementation example, ie: How get the semantic/performance without use single letter commands/hyper-dense coding!.
So, exist some code/tutorial in how do this as easy like http://journal.stuffwithstuff.com/2013/12/08/babys-first-gar...?
Not exactly CL, but it seems like a natural fit for Racket.