3 ms·
The article asserts that sharp variables are "pretty useful" without actually mentioning a use. What exactly would one use them for?
by jcl 18y ago
The article asserts that sharp variables are "pretty useful" without actually mentioning a use. What exactly would one use them for?
- Deestan 18y agoIt results in a human readable "pickle" format, which is its own reward, I believe.
- ken 18y agoI'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.
- herdrick 18y agoGraphs. http://news.ycombinator.com/item?id=549194 http://news.ycombinator.com/item?id=549194