Our great sponsors
-
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.
-
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.
No, it was rhetorical, because it's obviously (to an APL-family programmer), not bad!
Your cultural prejudice is showing. There are good reasons APL is written the way it is, and this example is simply bringing those benefits to C by writing it in the dense APL style. There are other APL derivatives, like J[1] that are written the same way. These projects are well-maintained. They aren't collapsing under a load of technical debt. The style works. To them, it's clean code.
[1]: https://github.com/jsoftware/jsource
Python's lambdas can have as many lines as you want. Just wrap parens around it. Hissp uses this form as a compilation target. Its REPL shows the Python compilation. Play around with it til you get it: https://github.com/gilch/hissp
At least for the contrived example from the article, the solution isn't to break up the code, but to use denser code. Use a regex.
Does anybody really think that e.g. sregex[1] is better than just learning and using the regex language directly? Because that's where this kind of thinking leads.
[1]: https://github.com/jwiegley/emacs-release/blob/master/lisp/o...
Beat me to it. Yes, I ran a quick benchmark[0] and not running a function always wins. now, one may argue that you are running a call, but if the interpreter was smart it would convert the small function calls to just a noops.
[0]: https://github.com/Nomarian/crapbenchmarks/tree/main/call
Summary
Related posts
- Function Composition in Programming Languages – Conor Hoekstra – CppNorth 2023 [video]
- If risc-v is successful, no need of those backdoor injectors which are compilers anymore (and absurd and grotesque bloats). Just write risc-v assembly without abusing the macro preprocessor.
- if you code in J for 6 months, you will no longer think in loops, and if you stay with it for 2 years, you will see that looping code was an artifact of early programming languages, ready to be displayed in museums along with vacuum tubes
- An oral history of Bank Python
- Breaking into q/kdb+