Making Lisp do Integration

You have problems, and we're glad to hear them. Explain the problem, what you have tried, and where you got stuck.
Feel free to share a little info on yourself and the course.
Forum rules
Please respect your teacher's guidelines. Homework is a learning tool. If we just post answers, we aren't actually helping. When you post questions, be sure to show what you have tried or what you don't understand.

Making Lisp do Integration

Postby Redwine » Sun Oct 28, 2018 10:58 am

Hello everyone!

As I've only started coding with Common Lisp 3 weeks ago, I am the novice of novices. I'm presently working on an assignment to make Lisp perform integration (not all forms, mind), but have been running into a problem where my defconstant containing variables throws the error "unbound-variable." Could you take a gander and tell me where I'm going wrong? (only parts of the code listed below)

(defconstant variable-symbols '(U V W X Y Z))

(defun indef-integral (F V)
(cond ((variable-p F)(make-quotient(make-power F 2) 2))
((sum-p F)(make-sum(indef-integral(sum-operand-1 F)V)
(indef-integral(sum-operand-2 F)V)))
((sub-p F)(make-sub(indef-integral(sub-operand-1 F)V)
(indef-integral(sub-operand-1 F)V)))
((power-p F)(make-power(indef-integral(power-operand-1 F)V)
(indef-integral(power-operand-1 F)V)))))
Redwine
 
Posts: 1
Joined: Sun Oct 28, 2018 10:52 am

Re: Making Lisp do Integration

Postby David Mullen » Thu Nov 01, 2018 12:56 pm

Impossible to say, without seeing the rest of the code. What's the purpose of the defconstant?
David Mullen
 
Posts: 76
Joined: Mon Dec 01, 2014 12:29 pm


Return to Homework

Who is online

Users browsing this forum: No registered users and 4 guests

cron