Functional Threading "macros"
Posted3 months agoActive3 months ago
aartaka.meTechstory
calmmixed
Debate
40/100
Programming LanguagesFunctional ProgrammingLisp
Key topics
Programming Languages
Functional Programming
Lisp
The article discusses the concept of threading macros in programming languages, specifically in Clojure and a language called 'lamber', and the discussion revolves around alternative approaches to achieve similar functionality in other languages.
Snapshot generated from the HN discussion
Discussion Activity
Light discussionFirst comment
1d
Peak period
3
33-36h
Avg / period
2
Key moments
- 01Story posted
Oct 6, 2025 at 6:46 AM EDT
3 months ago
Step 01 - 02First comment
Oct 7, 2025 at 2:38 PM EDT
1d after posting
Step 02 - 03Peak activity
3 comments in 33-36h
Hottest window of the conversation
Step 03 - 04Latest activity
Oct 8, 2025 at 3:27 AM EDT
3 months ago
Step 04
Generating AI Summary...
Analyzing up to 500 comments to identify key contributors and discussion patterns
ID: 45489913Type: storyLast synced: 11/20/2025, 2:38:27 PM
Want the full context?
Jump to the original sources
Read the primary article or dive into the live Hacker News thread when you're ready.
And re-implementing `comp` by hand can teach us more than we bargained for (all the way to compiler technology)... I blogged about it here: https://www.evalapply.org/posts/lessons-from-reimplementing-...
https://blog.fogus.me/2013/09/04/a-ha-ha-ha-aah.html
https://blog.fogus.me/2009/09/04/understanding-the-clojure-m...
Utilities for functions: https://arrow-kt.io/learn/collections-functions/utils/
>The language I’m using in this post is Lamber, my Lambda Calculus compiling language. It features a minimalist syntax with only functions, values, if-s, and operators like Wisp’s colon nesting operator and terminating period (similar to Lua’s end.)
You can write functions that notice they have fewer arguments than ostensibly required and partially apply themselves. Obviously the standard * can't do that because it's usefully variadic already.
Anyway, in the implementation of TXR, I've done this kind of thing in C, just with function calls: no macros. E.g. in eval.c, certain functions are prepared that the quasiquote expander uses:
static val consp_f, second_f, list_form_p_f, quote_form_p_f; static val xform_listed_quote_f;
"nao" means "not an object": it's a sentinel value used internally in the runt-time for various purposes, the most common of them being the termination of variadic argument lists.andf is an and combinator: it returns a function which passes its argument(s) to each function in turn; if anything returns nil, it stops calling functions and returns nil. Otherwise it returns the value of the last function.
The pa_this_that functions are partial applicator combinators, generalizations of bind1 and bind2. E.g. pa_12_1 means take a fucntion with arguments 1 2, returning a function which just takes 1 (so 2 is bound: this is like bind2). A bunch of these exist, and more coud be added if needed: pa_1234_1, pa_1234_34 pa_123_1, pa_123_2, pa_123_3, pa_12_1 and pa_12_2.