next up previous
Next: 4.5 eval (xleval.c) Up: 4 Xlispの組込み関数の定義 Previous: 4.3.4 member

4.4 cond

condもCで定義しています.xlcont.c

/* xcond - special form 'cond' */
LVAL xcond()
{
  LVAL list,val;
  
  /* find a predicate that is true */
  for (val = NIL; moreargs(); ) {
    
    /* get the next conditional */
    list = nextarg();
    
    /* evaluate the predicate part */
    if (consp(list) &&
        (val = xleval(car(list)))) {
      
      /* evaluate each expression */
      for (list = cdr(list);
           consp(list);
           list = cdr(list))
        val = xleval(car(list));
      
      /* exit the loop */
      break;
    }
  }
  
  /* return the value */
  return (val);
}


generated through LaTeX2HTML. M.Inaba 平成18年5月6日