What does the following function do in Scheme programming language -


(define (unknown (lambda (x y)   (cond     ((null? y) y)     ((x (car y)) (unknown x (cdr y))))     (else (cons (car y) (unknown x (cdr y))))))) 

i'm newbie when comes scheme , wanted know purpose of function came across in textbook. main doubt lies ((x (car y)) does. how expression executed without operators , yet don't come across errors while compiling. although i'm unable run program because values input x apparently not applicable function. please help.

scheme functions can take functions arguments, , can return functions. code makes sense if pass in function argument.

if call code this:

(unknown even? '(1 2 3 4 5)) 

then should return list (1 3 5). filtering function returns members of y result of applying function x member false.


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

visual studio 2010 - Connect to informix database windows form application -

android - Associate same looper with different threads -