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

  1.   I've added the 'if' macro to franz.  If you have any objections, it is still
  2. not too late to voice them.
  3.   I've also defined 'If' to be the same as 'if'.
  4.  
  5.   As I mentioned in my earlier request for comments, the 'if' macro is a
  6. cross between the mit version and a locally written version using keywords.
  7. The following documentation describes the various forms.
  8. As you know, you can test out the 'if' macro by using apply. for example:
  9.  
  10. => (apply 'if '(if a then b c  elseif d thenret else e))
  11. (cond (a b c) (d) (t e))
  12.  
  13.  
  14. ;
  15. ;  This macro is compatible with both the crufty mit-version and
  16. ; the keyword version at ucb.
  17. ;
  18. ;  simple summary:
  19. ;   non-keyword use:
  20. ;    (if a b) ==> (cond (a b))
  21. ;    (if a b c d e ...) ==> (cond (a b) (t c d e ...))
  22. ;   with keywords:
  23. ;    (if a then b) ==> (cond (a b))
  24. ;    (if a thenret) ==> (cond (a))
  25. ;    (if a then b c d e) ==> (cond (a b c d e))
  26. ;    (if a then b c  else d) ==> (cond (a b c) (t d))
  27. ;    (if a then b c  elseif d  thenret  else g)
  28. ;        ==> (cond (a b c) (d) (t g))
  29. ;
  30. ;   
  31. ;
  32. ;
  33. ; In the syntax description below,
  34. ;    optional parts are surrounded by [ and ],
  35. ;    + means one or more instances.
  36. ;    | means 'or'
  37. ;    <expr> is an lisp expression which isn't a keyword
  38. ;       The keywords are:  then, thenret, else, elseif.
  39. ;    <pred> is also a lisp expression which isn't a keyword.
  40. ; <if-stmt> ::=  <simple-if-stmt>
  41. ;            | <keyword-if-stmt>
  42. ; <simple-if-stmt> ::=  (if <pred> <expr>)
  43. ;               | (if <pred> <expr> <expr>)
  44. ; <keyword-if-stmt> ::= (if <pred> <then-clause> [ <else-clause> ] )
  45. ; <then-clause> ::=  then <expr>+
  46. ;            | thenret
  47. ; <else-clause> ::=  else <expr>+
  48. ;            | elseif <pred> <then-clause> [ <else-clause> ]
  49.  
  50.  
  51.  
  52.   
  53.  
  54.  
  55.