Search found 3 matches
- Mon Jan 05, 2009 5:58 pm
- Forum: Scheme
- Topic: variable not acceptable
- Replies: 1
- Views: 6944
variable not acceptable
Hello, I'm trying to run this code but unfortunately i receive an error. When i enter (make-product 'x 2) instead of returning back 2 * x returns that x is not acceptable :S What can i do for that? Thanks in advance for any help ! (define order 'infix) (define (deriv exp var) (cond ((constant? exp) ...
- Tue Dec 23, 2008 10:37 am
- Forum: Common Lisp
- Topic: accept both numbers and letters
- Replies: 4
- Views: 10895
Re: accept both numbers and letters
But how can i use the defmacro in order to simplify any given polynomial e.g (x + y)(x + y) → x2 + 2xy + y2 Thanks for replying. ;; Constructors (defun make-constant (num) num) (defun make-variable (sym) sym) ;;(defun p+ (poly1 poly2) ;; (list '+ poly1 poly2)) (defmacro p+ (poly1 poly2) `(list '+ ...
- Tue Dec 23, 2008 5:25 am
- Forum: Common Lisp
- Topic: accept both numbers and letters
- Replies: 4
- Views: 10895
accept both numbers and letters
Hey I need your help for a program in common lisp. The program has to do with polynomial manipulation. My problem is when i do simple arithmetic operations does not accept any letters e.g (p+ x 4) (defun p+ (p1 p2) (list '+ p1 p2)) (defun p+ (p1 p2) (+ p1 p2)) How can i make it in order to accept le...