Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> However, nesting is difficult to read when it becomes deep: the flow of execution moves right to left, rather than the left-to-right reading of normal code.

Laughs in LISP.



Lisp dialects used to have excellent threading macros, allowing for exactly the described linear style.


> Lisp dialects used to have excellent threading macros,

Used to?


Still do, but used to, too!


    (-> "a b c d" 
        .toUpperCase 
        (.replace "A" "X") 
        (.split " ") 
        first)
    "X"


Is there a name for this sort of construct/macro in lisp? I'm interested in seeing more examples of it, assuming it's common.


The Racket docs in them are pretty good: https://docs.racket-lang.org/threading/index.html


threading macros


Personally I do find lisp code terribly difficult to read because of the inside out nature of it. For tricky Lisp I used to use a tool that would generate control flow graphs for me to make it easier to grok.


Compose macros have existed for decades to handle that issue.


What tool is that?




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: