On 10/25/12 22:19, Ruthard Baudach wrote: >> == Auszüge aus der Nachricht von diogofsr vom 2012-10-25 17:52: >> Ruthard Baudach <ruthard.baud...@web.de> writes: ... >> I didn't try it, but as this is your first time writing Lisp, you might >> want to make these changes: >> >> --- /tmp/alt-tab.lisp 2012-10-25 13:37:35.591757537 -0200 >> +++ /tmp/new.lisp 2012-10-25 13:43:51.118854966 -0200 >> @@ -37,14 +37,14 @@ >> (setf *alt-tab-index* (mod (1+ *alt-tab-index*) (list-length >> *alt-tab-cycle*))) >> (select-window-by-number (nth *alt-tab-index* *alt-tab-cycle*))) >> ;; else start anew >> - ( >> + (t >> (setf *alt-tab-index* 1) >> (setf *alt-tab-cycle* (copy-list *alt-tab-list*)) >> ; if we've fokussed a frame without window, current-window will return >> nil => select last used >> (cond >> ((not (current-window)) >> (select-window-by-number (first *alt-tab-cycle*))) >> - ( >> + (t >> (push (window-number (current-window)) *alt-tab-cycle*) >> (select-window-by-number (second *alt-tab-cycle*)))))) >> >> The first form in a `cond' is evaluated and if it evaluates to a >> generalized true, it runs the body. >> >> So: >> >> (defvar *foo*) >> >> (cond ((setf *foo* nil) 4) >> (t 2)) >> ; => 2 >> >> (cond ((setf *foo* 42) 4) >> (t 2)) >> ; => 4 > > As far as I understood it, cond is the most general if - elsif - else > construct lisp knows, thus > > (defvar *foo*) > > (cond ((setf *foo* nil) 4) > ( 2 )) > => 2 > > At least this works for me using archlinux and the clisp of this > distribution. But adding the `T' in the last cond - clause might be more > portable?
Omitting T as the test in the last clause works and is portable, but, as CLTL expresses it, "is in questionable taste": http://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node84.html -- Dirk _______________________________________________ Stumpwm-devel mailing list Stumpwm-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/stumpwm-devel