Our great sponsors
-
polymorphic-functions
A function type to dispatch on types instead of classes with partial support for dispatching on optional and keyword argument types.
-
dense-numericals
Discontinued Numerical Computing library with https://github.com/digikar99/dense-arrays as the front-end
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
-
numericals
CFFI enabled SIMD powered simple-math numerical operations on arrays for Common Lisp [still experimental]
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
What I am calling parametric polymorphism is this test:
An example where this has been put to use is at dense-numericals - so, we have the one-arg-fn as the basic polymorph that actually does the dispatching. But since the remaining polymorphs (sin, cos, tan, etc; the ones in the macrolet) are what I'll call parametric, by simply defining these for type t, these are defined for anything that the one-arg-fn is defined for, thus enabling both optimal compilation without dispatch overheads, as well as no compiled code repetition; without this, one would have required about 7 polymorphs for each of the 14 or so functions in this file.
I made this while running into code modularity issues with the numericals project I attempted last year; I did discover specialization-store, but found its goals in conflict with what I wanted to achieve; so I ended up investing in this.
I made this while running into code modularity issues with the numericals project I attempted last year; I did discover specialization-store, but found its goals in conflict with what I wanted to achieve; so I ended up investing in this.
Currently I have put successfully this to use at dense-numericals - which I created over dense-arrays after finding CL arrays to be not that suitable, as compared to numpy or julia. Now, dense-numericals relies on passing the array pointer to C functions. However, IIUC, this runs into issues for what if the GC moves the arrays while the computation is still not done; is this worry valid? I think I ran into this while running multithreaded tests on CCL, ending up in segfaults.
There do exist libraries like cl-parametric-types that do it the way you seem to propose, but subjectively I find it a bit unweildy wrt to the other interactive aspects of lisp.