News for hackers. Stuff that matters.
Re:APL and Array Programming by chrisaycock on Friday July 08, 2022 @06:49PM (#32028737)
For anyone interested in array programming, the person who made k eventually created a query language called q:

https://code.kx.com/q/ref/

Now days we refer to tables-within-a-language as "dataframes". These are widely available in R, pandas, Spark, etc.

The q language inspired me to write my own language a few years back that added static typing to dataframes:

https://www.empirical-soft.com

Re:APL and Array Programming by kthielen on Friday July 08, 2022 @09:54PM (#32030549)
Very cool, this approach will inevitably catch on, I think.

I built a similar typed PL and compiler for Morgan Stanley back in 2013: https://github.com/morganstanley/hobbes

Re:APL and Array Programming by chrisaycock on Friday July 08, 2022 @10:07PM (#32030637)
I read about Hobbes years ago. The embeddability certainly caught my attention.

I wrote Empirical specifically for the use case of wanting to read a CSV file while inferring the type at compile time. Basically, a ton of compile-time function evaluation mixed with type providers.

Re:APL and Array Programming by kthielen on Friday July 08, 2022 @10:21PM (#32030765)
Yeah, I had this type constraint system for doing that kind of thing, so I can load a file at compile time to get the type structure and then compile/evaluate to process data in the file or files. Same thing for network connections between communicating processes (type constraints at compile-time decide a protocol, machine code at run-time assumes that protocol).
Re:APL and Array Programming by titanomachy on Friday July 08, 2022 @08:35PM (#32030009)
Your work might predate this, but spark/scala now has good support for typed dataframes (they’re called DataSets).
Re:APL and Array Programming by chrisaycock on Friday July 08, 2022 @10:02PM (#32030594)
Does Spark's Dataset have something like the "inferSchema" option when reading a CSV file? Everything I've read in Spark's documentation makes me think that Datasets require an explicit type provided by the user.

Empirical can infer a CSV's schema at compile time. If the file path can be determined at compile time, then the Empirical compiler will sample the CSV file and determine an appropriate type before the user's code is ever run. No need for an explicit type from the user, and yet we still have static typing.