<Sound As Pure Form> - a Forth-like language for a...
# linking-together
m
Sound As Pure Form - a Forth-like language for audio synthesis using lazy lists and APL-like auto-mapping. From the creator of SuperCollider
Other languages that inspired this one: APL, Joy, Haskell, Piccola, Nyquist, SuperCollider.
b
I enjoyed the manifesto-README
APL and FORTH (from which Joy derives) are both widely derided for being write-only languages. Nevertheless, there has yet to be a language of such concise expressive power as APL or its descendants. APL is powerful not because of its bizarre symbols or syntax, but due to the way it automatically maps operations over arrays and allows iterations at depth within arrays. This means one almost never needs to write a loop or think about operations one-at-a-time. Instead one can think about operations on whole structures.
k
While I agree personally with this perspective, teaching NumPy (whose core is APL in Python syntax) for many years lead me to the conclusion that for many people, loops seem more natural. Maybe due to prior exposure to more mainstream languages, I can't say. All my exercises started with "remember: no loops!", and yet, most solutions implemented by the students had at least one explicit loop.
g
FWIW: I endeared myself to my summer employer by taking a few minutes to rewrite Fortran-oriented-APL into APL-oriented-APL. What took 1 weekend to run on an S/370, took mere minutes.
e
This looks really cool, and if you want a more generalized language that is both stack and array based there's UIUA https://www.uiua.org/ Enjoy! Aside: discovering APL when trying to write a program to implement the Space Groups in architectural computation is what led me down the array programming and then Future of Coding (and then esolangs) wormhole. (The program is out as a C# based plugin for the visual programming language Grasshopper but hasn't been implemented in APL yet.)
k
BTW, anyone looking at APL for mind expansion should also have a look at implementation techniques. There are many open source implementations of APL-like languages to look at. Much of that code looks almost alien.
b
I’ve only skimmed, but Rob Pike’s ivy is a pretty easy read
b
All my exercises started with "remember: no loops!", and yet, most solutions implemented by the students had at least one explicit loop.
There is a duality between per-element vs. aggregate code. `if`<->`filter`, `for`<->`map` etc. But textually and mentally they look pretty different. I'm curious if there are any languages/notations seeking to minimize that gap — to make it easy to see both perspectives? [I think I've asked this before, and I suppose LINQ is a start] 🤔 Part of this gap though is not about element vs. aggregate. It's executable code that can do whatever vs. analyzable code explicitly composed from a core set of patterns. cf. SQL queries that are not simply executed but get analyzed & transformed in a query optimizer. And it's not like C++ loops don't undergo impressive compiler optimizations — but there is some different "feel" to the languages... 🤔 Perhaps the gap is also about dataflow? Patterns like
filter
constrain it significantly; capturing the whole flexibility you have with variables in loops requires something like Haskell's do notation <-> a whole zoo of combinators? Indeed, listening to Array Cast, they keep going on about a gazilion combinators to know. Which, let's face it, is hard to teach 😞 🍰 OK then, are there visual languages that expose this duality? Node-and-wire promise seeing dataflow directly without having to name all the patterns! It gets interesting with how to present data crossing element/aggregate domains — reductions like
max
or
sum
, broadcasts of single value into many iterations etc...
k
The large number of combinators is definitely an issue if you set out to cover all possible aggregate behaviors, and that's why I mostly stopped using APL in real life. But it can't the be cause of my observations with student exercises because they were designed to be solvable with just a small number of combinators that I had explained before.
I'd love to see a systematic approach to the duality, visual or other. The Smalltalk collection classes can be seen as an attempt, as can STL for C++. Both are pragmatic rather then systematic.
b
P.S. Forth Haiku Salon by Brad Nelson is another platform for (mostly visual) art based on Forth. [src, talks, slides] Like tixy.land and shadertoy, it takes the POV of computing a single pixel a time, given
x
,
y
,
t
inputs (plus some interactivity like mouse position). There is no cross-pixel interactions (iiuc; I see there is some statefulness via ! / @ small RAM). In this limited model though, duality is easy: can read the same per-pixel code as if it's operating on whole images at a time. E.g. I can formulate
mouse xy distance
to produce a radial field around the mouse, then
0.2 <
to apply a threshold producing a circle. But that's simple forced vectorization; Uiua can express a circle in similar way.
IBNIZ [explanation, browser port] is also similar, somewhat denser (single-char operators) and lower-level(?)