Posts

Showing posts with the label lisp

Common Lisp Tips and Tricks

A collection of simple tips and tricks for the inexperienced Common Lisp programmers like myself. List (and terminate) running threads Using SBCL native functions ;; list all - mind the names CL-USER> (sb-thread:list-all-threads) (#<SB-THREAD:THREAD "main thread" RUNNING {1001878913}> #<SB-THREAD:THREAD "auto-flush-thread" RUNNING {10020BFDB3}> #<SB-THREAD:THREAD "my main loop" RUNNING {100492B8E3}> ;; this is the thread i suspect #<SB-THREAD:THREAD "reader-thread" RUNNING {1004AEFD13}> #<SB-THREAD:THREAD "swank-indentation-cache-thread" RUNNING {1004AEFE23}> #<SB-THREAD:THREAD "finalizer" RUNNING {1001E30053}> #<SB-THREAD:THREAD "repl-thread" RUNNING {10020C1BC3}> #<SB-THREAD:THREAD "control-thread" RUNNING {1004AF2853}>) ;; find the thread by name and terminate it CL-USER> (sb-thread:terminate-thread (find "my main loop...

Responsibly Upgraded Your Lisp Machine!

Image
=== ALL USERS PLEASE NOTE ======= Compiler optimizations have been made to macro expand LET into a WITHOUT-INTERRUPTS special form so that it can PUSH things into a stack in the LET-OPTIMIZATION area, SETQ the variables and then POP them back when it's done. Don't worry about this unless you use multiprocessing. Note that LET could have been defined by: (LET ((LET '`(LET ((LET ',LET)) ,LET))) `(LET ((LET ',LET)) ,LET)) This is believed to speed up execution by as much as a factor of 1.01 or 3.50 depending on whether you believe our friendly marketing representatives. This code was written by a new programmer here (we snatched him away from Itty Bitti Machines where he was writing COUGHBOL code) so to give him confidence we trusted his vows of "it works pretty well" and installed it. From Linux fortune cookies Image source billyfung2010.blogspot.com