This page contains the description of the following commands week-day-number, when, while, wpowers,
The week-day-number function returns the week-day-number of a given date, starting at one for monday, ending at seven for sunday.
[Endymion] (setq x #:date:#[2005 5 01 0 0 0]) Sun May 01 2005 00:00:00 [Endymion] (week-day-number x) 7 [Endymion] (week-day-number #:date:#[2005 5 02 0 0 0]) 1 [Endymion] (week-day-number 'today) week-day-number : argument is not a date : today
The when macro takes at least two argument. Its expansion is (if test (progn x1 ... xn) ()). Said otherwise, the first argument is evaluated. If this gives false, the result is false. Otherwise, remaining arguments are evaluated in order. It could be defined as (dmd when (x . y) `(if ,x (progn ,@y) ())
[Endymion] (when) when : wrong number of arguments : 0 this should be at least 2 [Endymion] (when false (error)) () [Endymion] (when (= 1 1) 2 3) 3 [Endymion] (if true (print 'ok) (error)) ok ok [Endymion] (when true (print 'ok) (error)) ok error : wrong number of arguments : 0 this should be 3 [Endymion] (setq X '(when true (print 'ok) (error))) (when true (print 'ok) (error)) [Endymion] (eval X) ok error : wrong number of arguments : 0 this should be 3 [Endymion] X (if true (progn (print 'ok) (error)) ())
There is a symbolic macro of the same name described under do.
The while special form takes at leats two argument. It evaluates the first argument. If this gives nil, then execution stops, the result is nil. Otherwise, remaining arguments are evaluated. Execution restarts at the beginning. This could be defined as a macro
(dmd while (test . rest) `(tagbody restart (unless ,test (go end)) ,@rest (go restart) end))
With this definition, (while true (go end)) is valid; see for instance until, that explains how to use a gensym instead of constants like restart or end. Examples
[Endymion] (while) while : wrong number of arguments : 0 this should be at least 2 [Endymion] (while false 0) () [Endymion] (setq x (list 1 2 3)) (1 2 3) [Endymion] (while (consp x) (print (car x)) (setq x (cdr x))) 1 2 3 () [Endymion] (while (read) (print "ok ?")) [Endymion] 1 ok ? [Endymion] 2 ok ? [Endymion] 3 ok ? [Endymion] () ()
This function computes (w-1)^n*(w+1)^m, as a univariate polynomial with double precision coefficients. Both arguments should be integers less than 50.
[Endymion] (wpowers 0 0) #PD_s 1; [Endymion] (wpowers 3 0) #PD_s -1 + 3*z-3*z^2 + 1*z^3; [Endymion] (wpowers 0 4) #PD_s 1 + 4*z + 6*z^2 + 4*z^3 + 1*z^4; [Endymion] (wpowers 2 2) #PD_s 1-2*z^2 + 1*z^4; [Endymion] (wpowers 200 0) wpowers : argument out of bounds : 200 [Endymion] (wpowers 0 1/2) wpowers : not a fixnum : 1/2 [Endymion] (wpowers 0 -5) wpowers : argument out of bounds : -5
back to home page © INRIA 2005, 2006 Last modified $Date: 2008/08/05 15:10:34 $