News for hackers. Stuff that matters.
Re:Reading a Programmer's Guide to Common Lisp by kazinator on Thursday February 22, 2024 @05:44PM (#39474375)
TXR Lisp has a form of unhinged let in the "opip syntax" that underlies all of its threading macros.

https://www.nongnu.org/txr/txr-manpage.html#S-F2CAF1CB

For instance

  (flow 1
    (+ 2)
    (let x) ;; x is 3 now
    (+ 3)
    (let y) ;; y is 6
    (+ 4)   ;; pipeline value is 10 now
    (+ x y)) ;; 19 returned: (+ 3 6 10) 
There is a (let (var1 init1) (var2 init2) ...) syntax supported also. Both these variants act as pass-through pipe elements: they bind variables that are in scope of the rest of the pipe.

However, if you use the normal (let ((var init) ...) ...) syntax, then that is not special any more; it is just the regular let being threaded, like any other operator. It does not bind variables visible to the rest of the pipe.

Outside of this, there are only let and let* which resemble the Common Lisp ones.

Note that this construct makes sense even in pure code; it was not introduced for the sake of inserting side effects between variable definitions, but for capturing the output at specific points of the pipe, binding it to a name.

Re:Reading a Programmer's Guide to Common Lisp by pfdietz on Friday February 23, 2024 @03:32AM (#39478274)
There's a de facto standard macro for Common Lisp that does something similar, called nest. It's in UIOP.