Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

functional programming considered stupid

Name: Anonymous 2007-08-26 22:27 ID:FF/bd/VM

learn a real language morans

Name: Anonymous 2007-08-27 23:21 ID:S5UfSz07

then again...
typedef struct { int car; List* cdr; } List;
List* cons(int car, List* cdr)
{
   List* a;
   a = malloc (sizeof(List));
   a->car = car;
   a->cdr = cdr;
   return a;
}

List* factorAux(int n, int i)
{
      if (i > n) return NULL;
      else if divisible(n,i) return cons(i, factor(n/i, i));
      else return factor(n, i + 1);
}
List * factor(int n) { return factorAux(n,2); }

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List