Contents    Page-10    Prev    Next    Page+10    Index   

Tracing Equal


>(equal '(+ a (* b c)) '(+ a (* b c)))

  1> (EQUAL (+ A (* B C)) (+ A (* B C)))
    2> (EQUAL + +)
    <2 (EQUAL T)
    2> (EQUAL (A (* B C)) (A (* B C)))
      3> (EQUAL A A)
      <3 (EQUAL T)
      3> (EQUAL ((* B C)) ((* B C)))
        4> (EQUAL (* B C) (* B C))
          5> (EQUAL * *)
          <5 (EQUAL T)
          5> (EQUAL (B C) (B C))
            6> (EQUAL B B)
            <6 (EQUAL T)
            6> (EQUAL (C) (C))
              7> (EQUAL C C)
              <7 (EQUAL T)
              7> (EQUAL NIL NIL)
              <7 (EQUAL T)
            <6 (EQUAL T)
          <5 (EQUAL T)
        <4 (EQUAL T)
        4> (EQUAL NIL NIL)
        <4 (EQUAL T)
      <3 (EQUAL T)
    <2 (EQUAL T)
  <1 (EQUAL T)
T
This is our old friend, depth-first search, on two trees simultaneously.