-1

I'm using CLISP and am trying

(if ( = (first '(+ 2 3)) + ) 10 20) //10 and 20 are just placeholders

I am trying to create a program that converts between infix, postfix, and prefix. I believe that my first step should be finding the symbols +, -, *, and / in the string. There will be no parentheses in the input. So, i am trying to search for each symbol systematically. the advantage of my approach is the ability to prioritize * over + etc.

I have a general idea of my approach, but any thoughts would be nice. my first idea is:

(append (rest '(+ 2 3)) (list (first '(+ 2 3))))

and yes, i plan on using recursion.

Ankit Ahuja
  • 73
  • 2
  • 14

1 Answers1

0

some more googling brought me to What's the difference between eq, eql, equal, and equalp in Common Lisp? so i decided to implement "eq" instead of "=" and it worked just as expected.

Community
  • 1
  • 1
Ankit Ahuja
  • 73
  • 2
  • 14
  • 1
    Typically, you want to use EQL instead of EQ, except for the (very few) cases where you actually want to use EQ. – Vatine May 10 '12 at 03:57