'How to pass a procedure as a parameter in Racket Language?
(define (remove (lambda) lst)
(if (empty? lst)
0
(if ((lambda(car lst) = 'false))
(cons (car lst '() lambda (cdr lst)))
(lambda (cdr lst)))))
This piece of code is used to check if numbers in list pass the test called lambda, and return a list without the passed element.
So command like (remove (lambda (x) (= x 0)) (list 0 1 2 3)) would able to pass lambda function as a parameter and use it inside the remove function. How should I do that?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
