I keep getting this error when trying to run the code:
(let ((exp lambda (x y) (if (= y 1) x (* (exp x (- y 1)) x)))))
Error:
let: bad syntax in: (let ((exp lambda (x y) (if (= y 1) x (* (exp x (- y 1)) x)))))
My function is supposed to define recursive exponentiation, but I’m having problems with let.
You’re missing an opening parenthesis before the
lambda, and theletform is missing a body. Also, you can’t useletfor defining recursive functions; you need to useletrec(for Scheme) orlabels(for Common Lisp). Perhaps you meant this (Scheme):