,i am doing my assignment in Scheme. I am using Scheme MIT Interpreter and https://repl.it/languages/scheme to test my code.
First question is
; - in? procedure takes an element ‘el’ and a list ‘lst’. ; - It returns a boolean value. ; - When el is in lst it returns true, otherwise returns false. ; - Examples: ; (in? 3 ’(2 5 3)) ; evaluates to #t ; (in? 2 ’(1 (2) 5)) ; evaluates to #f ; - If lst is not a list, it produces an error..
my code is
(define lst())
(define el())
(define in? (lambda (el lst)
(if(null? lst)
#f
(if (eq? (car lst el ))
#t
(in? el cdr lst )))
(error "ERROR")))
(in? 3'(2 5 3))
I got error in MIT Interpreter below
The procedure #[compiled-procedure 13 ("global" #x14) #x14 #x2620cd4] has been called with 3 arguments; it requires exactly 2 arguments. ;To continue, call RESTART with an option number: ; (RESTART 1) => Return to read-eval-print level 1.
and when i test it in https://repl.it/languages/scheme
i got error like
Error: 2 is not a function [(anon)]
Why i am getting these errors?