newLISP Fan Club

Forum => newLISP in the real world => Topic started by: iNPRwANG on February 28, 2012, 04:31:34 PM

Title: Debug feature bracket match error?
Post by: iNPRwANG on February 28, 2012, 04:31:34 PM
While run this code:



(define (hello-world a)
(letn ((tmp 10)
      (val1 (* tmp 2))
  (val2 (* tmp 2)))
)
)

(debug (hello-world 10))




(define (hello-world a)

  #(letn ((tmp 10) (val1 (* tmp 2)) (val2 (* tmp 2))))#)





[-> 3 ] s|tep n|ext c|ont q|uit > s



-----



(define (hello-world a)

  (letn ((tmp 10) (val1 #(* tmp 2)#) (val2 (* tmp 2)))))





[-> 4 ] s|tep n|ext c|ont q|uit > s



-----



(define (hello-world a)

  (letn ((tmp 10) (val1 #(* tmp 2)#) (val2 (* tmp 2)))))





RESULT: 20



[<- 4 ] s|tep n|ext c|ont q|uit > s



-----



(define (hello-world a)

  (letn ((tmp 10) (val1 #(* tmp 2)#) (val2 (* tmp 2)))))





; This cause the bracket match error.



Is it should be]






[-> 4 ] s|tep n|ext c|ont q|uit > s



-----



(define (hello-world a)

  (letn ((tmp 10) (val1 #(* tmp 2)#) (val2 (* tmp 2)))))





RESULT: 20



[<- 4 ] s|tep n|ext c|ont q|uit > s



-----



(define (hello-world a)

  #(letn ((tmp 10) (val1 (* tmp 2)) (val2 (* tmp 2))))#)





RESULT: nil



[<- 3 ] s|tep n|ext c|ont q|uit >
Title: Re: Debug feature bracket match error?
Post by: cormullion on February 29, 2012, 03:35:39 AM
Looks OK here:


newLISP v.10.3.2 on OSX IPv4/6 UTF-8, execute 'newlisp -h' for more info.
>
(define (hello-world a)
   (letn ((tmp 10)
          (val1 (* tmp 2))
         (val2 (* tmp 2)))      
      )
   )
(lambda (a)
 (letn ((tmp 10) (val1 (* tmp 2)) (val2 (* tmp 2)))))
> (debug (hello-world 10))
-----
(define (hello-world a)
  (letn ((tmp 10) (val1 (* tmp 2)) (val2 (* tmp 2)))))
[-> 3 ] s|tep n|ext c|ont q|uit > s
-----
(define (hello-world a)
  (letn ((tmp 10) (val1 (* tmp 2)) (val2 (* tmp 2)))))
[-> 4 ] s|tep n|ext c|ont q|uit > s
-----
(define (hello-world a)
  (letn ((tmp 10) (val1 (* tmp 2)) (val2 (* tmp 2)))))
RESULT: 20
[<- 4 ] s|tep n|ext c|ont q|uit > s
-----
(define (hello-world a)
  (letn ((tmp 10) (val1 (* tmp 2)) (val2 (* tmp 2)))))
[-> 4 ] s|tep n|ext c|ont q|uit > s
-----
(define (hello-world a)
  (letn ((tmp 10) (val1 (* tmp 2)) (val2 (* tmp 2)))))
RESULT: 20
[<- 4 ] s|tep n|ext c|ont q|uit > s
-----
(define (hello-world a)
  (letn ((tmp 10) (val1 (* tmp 2)) (val2 (* tmp 2)))))
RESULT: nil
[<- 3 ] s|tep n|ext c|ont q|uit > s
nil
>
Title: Re: Debug feature bracket match error?
Post by: Lutz on February 29, 2012, 06:59:18 AM
From the manual description of the 'trace' function:


QuoteIf an expression occurs more than once in a function, the first occurrence of the executing function will always be highlighted (bracketed).


This only affects the highlighting, the debugger will always execute expressions in correct order. For internal reasons this cannot be avoided, or would need an unreasonable amount of code to work around it.





Ps: not sure, why the hashmark brackets don't show up on Cormullion's example. Perhaps he uses 'trace-highlight' '?
Title: Re: Debug feature bracket match error?
Post by: cormullion on February 29, 2012, 07:58:57 AM
Yes, sorry, I got the wrong end of the stick on this. Was going to delete the post but errors are instructive... :)
Title: Re: Debug feature bracket match error?
Post by: iNPRwANG on February 29, 2012, 04:38:51 PM
Quote from: "Lutz"From the manual description of the 'trace' function:


QuoteIf an expression occurs more than once in a function, the first occurrence of the executing function will always be highlighted (bracketed).


This only affects the highlighting, the debugger will always execute expressions in correct order. For internal reasons this cannot be avoided, or would need an unreasonable amount of code to work around it.





Ps: not sure, why the hashmark brackets don't show up on Cormullion's example. Perhaps he uses 'trace-highlight' '?


I understand. Thanks. :)