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

The article asserts that sharp variables are "pretty useful" without actually mentioning a use. What exactly would one use them for?


I've seen them used to create inline infinite lists:

    (loop for loop-this in '#1=(:a :b :c . #1#)
          for just-once in '(1 2 3 4 5 6 7)
          do (format t "~S => ~S~%" just-once loop-this))
    =>
    1 => :A
    2 => :B
    3 => :C
    4 => :A
    5 => :B
    6 => :C
    7 => :A
    NIL
This encapsulates the "loop over this list forever" at its definition, instead of making me use an array and using length/modulo where it's used. There are of course many other solutions, but this one is both short and perfectly describes what I want.

Many Lisp library functions take lists as inputs (no kidding!), so this is a very efficient alternative to actually creating a repetitive list. (Pythoners: think itertools.cycle).

Also, any time you want to build a simple-but-not-trivial graph inline (great for unit testing), these come in handy.


It results in a human readable "pickle" format, which is its own reward, I believe.





Consider applying for YC's Summer 2026 batch! Applications are open till May 4

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

Search: