Rohit
0
Q:

how to pass unction in scheme

/* Scheme code example for passing multiple function into a function) */

(define (square x) (* x x))
(define (mul_two x) (* 2 x))

(define (new_fun fun1 fun2) (lambda (x) (fun2 (fun1 x))))


/* The line below is to run the code in scheme  */
((new_fun square mul_two) 10)
1

New to Communities?

Join the community