home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / bsd_srcs / usr.bin / lisp / lispnews / text0031.txt < prev    next >
Encoding:
Text File  |  1985-11-10  |  1.2 KB  |  38 lines

  1.   Would anyone object if we added a macro called 'if' to the default franz
  2. system?   'if' is a common name and I want to make sure that it doesn't
  3. break any existing code before I add it.
  4.  
  5. Some background:
  6.  At mit the 'if' macro is used all over the place.
  7.  Its form is
  8.      (if <predicate> <then-expr> [ <else-expr>])
  9.     
  10.  I've always felt that macros should make the code more readable and
  11.  that the 'if' macro makes code more obscure because it isn't easy
  12.  to tell in complicated 'if' expressions where the <then-expr>
  13.  and <else-expr>'s begin.  Also, there is no provision for
  14.  an 'elseif' expression.
  15.  
  16.  I wrote a macro called 'If' which uses keywords to separate clauses.
  17.  (If <pred> 
  18.     then <then-expr> 
  19.   [elseif <pred> then <then-expr>]* 
  20.   [else <else-expr>])
  21.  
  22.  These two macros are not incompatible.  one macro could do the job
  23.  of both.  There is an ambigous case:
  24.     (if p then x) could be (cond (p then) (t x))
  25.             or (cond (p x))
  26.  but it isn't likely that 'if' macro users would write something like
  27.  that.
  28.  
  29. Thus I propose that we add a macro, if, which act's like 'If' if
  30. its second arg is 'then' or like 'if' it the second arg is not 'then'
  31. and there are two or three arguments.  Other cases would cause
  32. an error.
  33.  
  34.  
  35.     
  36.  
  37.  
  38.