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

PROGRAMMING CHALLENGE

Name: Anonymous 2010-07-16 18:57


This one should be difficult enough for you guys,

Write a function foo that takes a number n and returns a function that takes a number i, and returns n incremented by i.


My submission, in Scheme


(define (foo num)
  (lambda (x) (+ x num)))

Name: Anonymous 2010-07-18 4:18

>>6
>>11
int main()
{
    int (*my)(int) = foo(1);
    int (*mi)(int) = foo(2);
   
    printf(" my: %d \n mi: %d\n", my(0), mi(0));

    return 0;
}

my: 2
 mi: 2

EXPERT WINDOWS PROGRAMMERS

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