All commands, alphabetic order; letter U

This page contains the description of the following commands unless, until, untrace,

(unless test x1 ... xn) (Lisp macro)

The unless macro takes at least two argument. Its expansion is (if (not test) (progn x1 ... xn) ()). Said otherwise, the first argument is evaluated. If this gives non-false, the result is false. Otherwise, remaining arguments are evaluated in order.

[Endymion] (unless)
unless : wrong number of arguments : 0 this should be at least 2
[Endymion] (unless (= 1 1) (error))
()
[Endymion] (unless (= 1 2) 1 2 3)
3
[Endymion] (setq X '(unless (= 3 4) (print 'ok) (error)))
(unless (= 3 4) (print 'ok) (error))
[Endymion] (eval X)
ok
error : wrong number of arguments : 0 this should be 3
[Endymion] X
(if (not (= 3 4)) (progn (print 'ok) (error)) ())

(until test x1 ... xn ) (Lisp special form)

See also There is a symbolic macro of the same name described under do.

The until special form takes at least two arguments; It behaves like while, but the value of the test is changed. The special form evaluates the firsr argument. If this is not false, execution stops, and this value is the return value of the call. Otherwise, remaining arguments are evaluated. Then the process restarts at the beginning. The special form could have been implemented as a macro like

(dmd until (test . rest)
  (let ((W (gensym)) (restart (gensym)) (end (gensym)))
     `(let ((,W ()))
          (tagbody
           ,restart
           (when (setq ,W ,test) (go ,end))
           ,@rest
           (go ,restart)
           ,end)
          ,W)))

Examples

[Endymion] (until)
until : wrong number of arguments : 0 this should be at least 2
[Endymion] (until true 0)
true
[Endymion] (setq x '(1 2 3))
(1 2 3)
[Endymion] (until (null x) (print (car x)) (setq x (cdr x)))
1
2
3
true
[Endymion] (until (read) (print "say () to continue"))
[Endymion] ()
say () to continue
[Endymion] ()
say () to continue
[Endymion] ok
ok

untrace (x1,...,xn) (Symbolic macro)

The untrace macro can be used to untrace symbolic functions via the trace_one function. See compiler.


Valid XHTML 1.0 Strict back to home page © INRIA 2005, 2006 Last modified $Date: 2009/01/08 17:43:30 $